{"id":13496420,"url":"https://github.com/wechat-miniprogram/kbone-api","last_synced_at":"2025-04-15T19:30:20.949Z","repository":{"id":48172278,"uuid":"249905776","full_name":"wechat-miniprogram/kbone-api","owner":"wechat-miniprogram","description":null,"archived":false,"fork":false,"pushed_at":"2020-06-10T14:38:08.000Z","size":169,"stargazers_count":73,"open_issues_count":9,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T01:06:12.846Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/wechat-miniprogram.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":"2020-03-25T06:41:43.000Z","updated_at":"2023-03-01T04:34:23.000Z","dependencies_parsed_at":"2022-09-26T18:40:50.627Z","dependency_job_id":null,"html_url":"https://github.com/wechat-miniprogram/kbone-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wechat-miniprogram","download_url":"https://codeload.github.com/wechat-miniprogram/kbone-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249138482,"owners_count":21218894,"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","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":[],"created_at":"2024-07-31T19:01:47.609Z","updated_at":"2025-04-15T19:30:20.620Z","avatar_url":"https://github.com/wechat-miniprogram.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"## kbone-api\n\n**kbone-api**是一个能同时支持 小程序和 web 开发的多端 api 库。\n\n## 特性\n\n* 针对基于 kbone 的多端开发，满足在 Web 上直接使用小程序相关 api\n* 不依赖 kbone 和 kbone-ui，一个无依赖的小程序 api 的跨端库\n* 完整对齐 [wx[apis]](https://developers.weixin.qq.com/miniprogram/dev/api/)\n* 同时支持 promise 化和 callback 调用\n\n\n\n## 快速上手\n\n下载 kbone-api\n\n```\nnpm install kbone-api\n```\n\n通过模块的方式直接导出模块并使用：\n```js\nimport kboneAPI from 'kbone-api'\n\nkboneAPI.request()\nkboneAPI.showToast()\nkboneAPI.showModal()\n```\n\n为了方便 Vue 开发，可以直接使用 Vue.use(kboneAPI) 来设置全局对象.\n\n```js\n# main.js\nimport Vue from 'vue'\n\nVue.use(kboneAPI)\n\n# logic code\n\u003cscript\u003e\nexport default {\n    name: \"LoginComponents\",\n    methods: {\n        gotologin() {\n            return this.$api.login().then(() =\u003e {\n                this.$api.showToast({\n                    title: \"登录成功\",\n                })\n            })\n        },\n        getSetting() {\n            // 获取用户设置\n            return this.$api.getSetting()\n                .then(res =\u003e {\n                    this.$api.showToast({\n                        title: res.nickName || \"零度的田\"\n                    })\n                })\n        }\n    }\n}\n\u003c/script\u003e\n```\n\n## 文档\n\n所有 api 使用对齐小程序 api，具体内容可以参考 [小程序 api](https://developers.weixin.qq.com/minigame/dev/api/)。\n\n线上体验地址为：[api/ui/](https://wechat-miniprogram.github.io/api/ui/#/)\n\n## LICENSE\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechat-miniprogram%2Fkbone-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwechat-miniprogram%2Fkbone-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechat-miniprogram%2Fkbone-api/lists"}