{"id":18938237,"url":"https://github.com/wechat-miniprogram/kbone-template-react","last_synced_at":"2025-06-20T12:06:22.030Z","repository":{"id":36260258,"uuid":"205974061","full_name":"wechat-miniprogram/kbone-template-react","owner":"wechat-miniprogram","description":"a simple react template for kbone","archived":false,"fork":false,"pushed_at":"2022-04-06T02:13:10.000Z","size":413,"stargazers_count":141,"open_issues_count":0,"forks_count":17,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-03-28T23:11:13.325Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/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":"2019-09-03T02:36:33.000Z","updated_at":"2025-03-20T03:37:43.000Z","dependencies_parsed_at":"2022-08-08T13:47:42.862Z","dependency_job_id":null,"html_url":"https://github.com/wechat-miniprogram/kbone-template-react","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-template-react","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-template-react/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-template-react/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fkbone-template-react/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wechat-miniprogram","download_url":"https://codeload.github.com/wechat-miniprogram/kbone-template-react/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249120433,"owners_count":21215951,"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-11-08T12:13:50.744Z","updated_at":"2025-04-15T17:39:41.938Z","avatar_url":"https://github.com/wechat-miniprogram.png","language":"JavaScript","readme":"# react-kbone\n\n使用 react 多端开发(小程序和Web)，基于 [kbone](https://github.com/Tencent/kbone) 的 element 和 render。\n\n## 特性\n\n* 一键接入，立即使用\n* 支持完整 JSX 语法，任意位置任意方式书写 JSX\n\n## 一套语法多端运行\n\n```jsx\nfunction Counter() {\n  const [count, setCount] = useState(0)\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e setCount(count - 1)}\u003e-\u003c/button\u003e\n      \u003cspan\u003e{count}\u003c/span\u003e\n      \u003cbutton onClick={() =\u003e setCount(count + 1)}\u003e+\u003c/button\u003e\n      \u003cdiv onClick={clickHandle}\u003e跳转\u003c/div\u003e\n    \u003c/div\u003e\n  )\n}\n\nfunction clickHandle() {\n  if ('undefined' != typeof wx \u0026\u0026 wx.getSystemInfoSync) {\n    wx.navigateTo({\n      url: '../log/index?id=1',\n    })\n  } else {\n    location.href = 'log.html'\n  }\n}\n\nexport default Counter\n```\n\n## 快速开始\n\n```\nnpx kbone-cli init my-app\ncd my-app\nnpm run mp        // 开发小程序\nnpm run build:mp  // 构建小程序\nnpm run web       // 开发 web\nnpm run build     // 构建 web\n```\n\n\n## 目录说明\n\n```\n├─ dist\n│  ├─ mp     // 微信开发者工具指向的目录，用于生产环境\n│  ├─ web    // web 编译出的文件，用于生产环境\n├─ build     // 构建相关\n├─ src\n│  ├─ assets\n│  ├─ components     // 存放所有组件\n│  ├─ log.jsx        // 入口文件，会 build 成 log.html\n│  └─ index.jsx      // 入口文件，会 build 成 index.html\n```\n\n## 注意事项\n\nreact 并没有提供根组件实例的销毁方法（如 vue.$destroy），所以在多页应用中页面关闭时不会触发该页面组件的 componentWillUnmount 钩子。开发者可自行监听 wxunload 或 beforeunload 事件来进行页面的销毁工作，比如调用 render 方法渲染一个空节点，强行触发页面组件的 componentWillUnmount 钩子。\n\n## 谁在使用 kbone？\n\n\u003ctable\u003e\n\t\u003ctbody\u003e\n\t\t\u003ctr\u003e\n\t\t\t\u003ctd\u003e\n        \u003ca target=\"_blank\" href=\"https://developers.weixin.qq.com/community/develop/mixflow\"\u003e\n          \u003cimg width=\"200px\" src=\"https://raw.githubusercontent.com/wechat-miniprogram/kbone/develop/docs/images/code1.jpg\"\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n\t\t\t\u003ctd\u003e\n        \u003ca target=\"_blank\" href=\"http://omijs.org\"\u003e\n          \u003cimg width=\"200px\" src=\"https://github.com/Tencent/omi/raw/master/assets/omi-cloud.jpg\"\u003e\n        \u003c/a\u003e\n      \u003c/td\u003e\n\t\t\t\u003ctd width=\"92px\"\u003e\n        \u003ca target=\"_blank\" href=\"https://github.com/Tencent/omi/issues/new\"\u003e告诉我们\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## License\n\nMIT \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechat-miniprogram%2Fkbone-template-react","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwechat-miniprogram%2Fkbone-template-react","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechat-miniprogram%2Fkbone-template-react/lists"}