{"id":20850010,"url":"https://github.com/david-desmaisons/vue-ajax-handler","last_synced_at":"2026-04-19T21:32:32.671Z","repository":{"id":55329932,"uuid":"207941622","full_name":"David-Desmaisons/vue-ajax-handler","owner":"David-Desmaisons","description":"Ultra minimal generic vue component to deal with ajax loading","archived":false,"fork":false,"pushed_at":"2021-01-05T14:22:31.000Z","size":1317,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T12:31:11.775Z","etag":null,"topics":["ajax","component","vuejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/David-Desmaisons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-12T01:49:57.000Z","updated_at":"2020-08-06T03:17:39.000Z","dependencies_parsed_at":"2022-08-16T07:50:46.394Z","dependency_job_id":null,"html_url":"https://github.com/David-Desmaisons/vue-ajax-handler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/David-Desmaisons/vue-ajax-handler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Desmaisons%2Fvue-ajax-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Desmaisons%2Fvue-ajax-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Desmaisons%2Fvue-ajax-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Desmaisons%2Fvue-ajax-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/David-Desmaisons","download_url":"https://codeload.github.com/David-Desmaisons/vue-ajax-handler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/David-Desmaisons%2Fvue-ajax-handler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28038767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","component","vuejs"],"created_at":"2024-11-18T03:07:41.939Z","updated_at":"2025-12-25T22:10:47.043Z","avatar_url":"https://github.com/David-Desmaisons.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vue-ajax-handler\n\n[![CircleCI](https://circleci.com/gh/David-Desmaisons/vue-ajax-handler.svg?style=shield)](https://circleci.com/gh/David-Desmaisons/vue-ajax-handler)\n[![Coverage](https://codecov.io/gh/David-Desmaisons/vue-ajax-handler/branch/master/graph/badge.svg)](https://codecov.io/gh/David-Desmaisons/vue-ajax-handler)\n[![GitHub open issues](https://img.shields.io/github/issues/David-Desmaisons/vue-ajax-handler.svg)](https://github.com/David-Desmaisons/vue-ajax-handler/issues)\n[![Npm version](https://img.shields.io/npm/v/vue-ajax-handler.svg)](https://www.npmjs.com/package/vue-ajax-handler)\n[![MIT License](https://img.shields.io/github/license/David-Desmaisons/vue-ajax-handler.svg)](https://github.com/David-Desmaisons/vue-ajax-handler/blob/master/LICENSE)\n\nUltra minimal generic vue component to deal with ajax loading\n\n## Usage\n\nAdapted from: https://adamwathan.me/renderless-components-in-vuejs/\n\nPerform an ajax call and delegate the rendering to:\n\n- `loading` slot when loading\n\n- `default` slot passing data as parameter in case of success.\n\n- `error` slot passing error as parameter in case of error.\n\nThis a generic library with no dependency on ajax library, so\n\n  - The component parent should provide a get function using the provide API. It could be axios get or fetch, or any ajax library.\n\n```HTML\n\u003cajax-handler url=\"https://api.github.com/orgs/vuejs/repos\"\u003e\n  \u003ctemplate #default=\"{data}\"\u003e\n    \u003cp\u003e{{data.data[0].name}}\u003c/p\u003e\n  \u003c/template\u003e\n\u003c/ajax-handler\u003e\n```\n\n```javascript\nimport { ajaxHandler } from 'vue-ajax-handler'\nimport { get } from \"axios\";\n\nexport default {\n  components: {\n    ajaxHandler\n  },\n  provide: {\n    get\n  }\n}\n```\n\n## API\n\n### ajax-handler \n\n#### slots \n\n- `loading` slot to render loading feedback \n\n- `error` slot to render error feedback \n\n- `default` slot to render data when loaded. Receives data as parameter. \n\n#### props \n\n- `url` ***String*** (*required*) \n\n  The url used to make ajax request. \n  \n#### events \n- `loading` payload: ***Boolean*** emitted when loading changes. \n\n- `error` payload: ***Error*** emitted when error changes. \n\n- `data` payload: ***Object*** emitted when data is loaded, payload: the corresponding data. \n\n#### methods \n\n- `load()` \n\n  Perform an ajax call.\n  Automatically called by created hook. \n\n## Installation\n\n```\nnpm install vue-ajax-handler\n```\n\n## Project setup\n\n```\nnpm install\n```\n\n### Compiles and hot-reloads for development\n\n```\nnpm run serve\n```\n\n### Compiles and minifies for production\n\n```\nnpm run build\n```\n\n### Run your tests\n\n```\nnpm run test\n```\n\n### Lints and fixes files\n\n```\nnpm run lint\n```\n\n### Run your unit tests\n\n```\nnpm run test:unit\n```\n\n### Customize configuration\n\nSee [Configuration Reference](https://cli.vuejs.org/config/).\n\n### Update the API section of README.md with generated documentation\n\n```\nnpm run doc:build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-desmaisons%2Fvue-ajax-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavid-desmaisons%2Fvue-ajax-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavid-desmaisons%2Fvue-ajax-handler/lists"}