{"id":13691875,"url":"https://github.com/uni-helper/axios-adapter","last_synced_at":"2025-10-29T01:36:48.560Z","repository":{"id":61271598,"uuid":"548984575","full_name":"uni-helper/axios-adapter","owner":"uni-helper","description":"为 uni-app 打造的 axios 适配器，支持全平台","archived":false,"fork":false,"pushed_at":"2025-10-19T12:48:27.000Z","size":404,"stargazers_count":50,"open_issues_count":14,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T22:01:59.948Z","etag":null,"topics":["axios-adapter","http","request","uniapp-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uni-helper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["ModyQyW","KeJunMao","Neil Lee","FliPPeDround"],"custom":["https://afdian.com/a/kejun","https://github.com/ModyQyW/sponsors","https://afdian.com/a/zguolee","https://afdian.com/a/flippedround"]}},"created_at":"2022-10-10T13:48:50.000Z","updated_at":"2025-10-14T23:32:28.000Z","dependencies_parsed_at":"2023-10-16T08:33:46.320Z","dependency_job_id":"380ece34-72ae-42a2-bdbe-db217ff40491","html_url":"https://github.com/uni-helper/axios-adapter","commit_stats":{"total_commits":23,"total_committers":2,"mean_commits":11.5,"dds":0.04347826086956519,"last_synced_commit":"4fecc461508826bbebfe1d147f5e71dc3b8ef3c4"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/uni-helper/axios-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uni-helper%2Faxios-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uni-helper%2Faxios-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uni-helper%2Faxios-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uni-helper%2Faxios-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uni-helper","download_url":"https://codeload.github.com/uni-helper/axios-adapter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uni-helper%2Faxios-adapter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281544212,"owners_count":26519552,"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-10-28T02:00:06.022Z","response_time":60,"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":["axios-adapter","http","request","uniapp-plugin"],"created_at":"2024-08-02T17:00:51.227Z","updated_at":"2025-10-29T01:36:48.544Z","avatar_url":"https://github.com/uni-helper.png","language":"TypeScript","funding_links":["https://github.com/sponsors/ModyQyW","https://github.com/sponsors/KeJunMao","https://github.com/sponsors/Neil Lee","https://github.com/sponsors/FliPPeDround","https://afdian.com/a/kejun","https://github.com/ModyQyW/sponsors","https://afdian.com/a/zguolee","https://afdian.com/a/flippedround"],"categories":["Lib 工具库"],"sub_categories":[],"readme":"\u003cimg src=\"./assets/logo.svg\" alt=\"logo of @uni-helper/axios-adapter repository\" width=\"100\" height=\"100\" align=\"right\" /\u003e\n\n# @uni-helper/axios-adapter\n\n\u003e 适用于 Vue2 和 Vue3 的 uniapp Axios 适配器\n\n## 安装\n\n```\npnpm i @uni-helper/axios-adapter axios\n```\n\n## 使用\n\n\u003cdetails\u003e\n\u003csummary\u003e点击查看平台兼容性\u003c/summary\u003e\n\n| Vue2 | Vue3 |\n| ---- | ---- |\n| √    | √    |\n\n| App                                      | 快应用 | 微信小程序 | 支付宝小程序 | 百度小程序 | 字节小程序 | QQ 小程序 |\n| ---------------------------------------- | ------ | ---------- | ------------ | ---------- | ---------- | --------- |\n| HBuilderX 3.4.8\u003cbr/\u003eapp-vue\u003cbr/\u003eapp-nvue | √      | √          | √            | √          | √          | √         |\n\n| 钉钉小程序 | 快手小程序 | 飞书小程序 | 京东小程序 |\n| ---------- | ---------- | ---------- | ---------- |\n| √          | √          | √          | √          |\n\n| H5-Safari | Android Browser | 微信浏览器(Android) | QQ 浏览器(Android) | Chrome | IE  | Edge | Firefox | PC-Safari |\n| --------- | --------------- | ------------------- | ------------------ | ------ | --- | ---- | ------- | --------- |\n| √         | √               | √                   | √                  | √      | √   | √    | √       | √         |\n\n\u003c/details\u003e\n\n### 基本用法\n\n```ts\nimport axios from 'axios'\nimport { createUniAppAxiosAdapter } from '@uni-helper/axios-adapter'\n\naxios.defaults.adapter = createUniAppAxiosAdapter()\n```\n\n或者创建自定义实例\n\n```ts\nimport axios from 'axios'\nimport { createUniAppAxiosAdapter } from '@uni-helper/axios-adapter'\n\nconst instance = axios.create({ adapter: createUniAppAxiosAdapter() })\n```\n\n### 与 [useAxios](https://vueuse.org/integrations/useAxios/) 一起使用\n\n```ts\nimport axios from 'axios'\nimport { createUniAppAxiosAdapter } from '@uni-helper/axios-adapter'\n\naxios.defaults.adapter = createUniAppAxiosAdapter()\nconst { data, isFinished } = useAxios('/posts')\n```\n\n### 上传和下载\n\n```ts\n// 下载\naxios.download('/')\n// or\naxios.request({\n  url: '/',\n  method: 'download',\n})\n\n// 上传\naxios.upload('/', new File([new Blob()], 'fake file'))\n// or\naxios.request({\n  url: '/',\n  method: 'upload',\n  data: new File([new Blob()], 'fake file'),\n})\n```\n\n### 小程序\n\n自 axios 1.4.0 开始，axios 内部已经处理了小程序的兼容性问题\n\n\u003cdetails\u003e\n\u003csummary\u003e我要使用 `FormData` 和 `Blob` 对象\u003c/summary\u003e\n\n小程序没有 `FormData` 和 `Blob` 对象，\n使用 `pnpm add miniprogram-formdata miniprogram-blob` 来安装对应的 polyfill，然后使用插件\n```ts\n// vite.config.js\nimport uniAxiosAdapter from '@uni-helper/axios-adapter/vite'\n\nexport default {\n  plugins: [\n    uniAxiosAdapter()\n  ]\n}\n```\n\n如果你使用的是 Vue CLI，改用 `@uni-helper/axios-adapter/webpack` 即可\n\n\u003c/details\u003e\n\n### 版本\n\n自 1.4.0 开始，请始终保持主版本号和次版本号与 axios 一致。例如当你安装了 1.5.1 版本时，你可以安装 axios 的 1.5.x 版本。\n\n这样做的目的是始终支持最新的 axios。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funi-helper%2Faxios-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funi-helper%2Faxios-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funi-helper%2Faxios-adapter/lists"}