{"id":19725477,"url":"https://github.com/easychen/easy-starter","last_synced_at":"2025-04-29T23:30:45.226Z","repository":{"id":145558096,"uuid":"137630201","full_name":"easychen/easy-starter","owner":"easychen","description":"一个整合了 react 、 react-router v4 和 mobx 的简单起始项目脚手架","archived":false,"fork":false,"pushed_at":"2018-07-16T10:46:09.000Z","size":89,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T20:11:15.107Z","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/easychen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-17T05:01:12.000Z","updated_at":"2023-08-12T16:38:20.000Z","dependencies_parsed_at":"2023-07-22T10:00:20.159Z","dependency_job_id":null,"html_url":"https://github.com/easychen/easy-starter","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/easychen%2Feasy-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Feasy-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Feasy-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/easychen%2Feasy-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/easychen","download_url":"https://codeload.github.com/easychen/easy-starter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251599749,"owners_count":21615574,"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-11T23:30:02.892Z","updated_at":"2025-04-29T23:30:45.215Z","avatar_url":"https://github.com/easychen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy-starter 说明\n\n[Easy-starter]() 是一个整合了 react 、 react-router v4 和 mobx 的起始项目脚手架。clone 到本地，然后运行 yarn start  就可以开始进行开发。\n\n## 添加页面\n\n### 在 component 中添加页面，比如 index.js\n\n```\nimport React, { Component } from 'react';\nimport { observer , inject } from 'mobx-react';\nimport { Redirect } from 'react-router-dom';\n\n@inject(\"store\")\n@observer\nexport default class Index extends Component\n{\n    render()\n    {\n        return \u003cp\u003eWelcome to {this.props.store.appname}\u003c/p\u003e;\n    }\n} \n```\n\n\n### 在 App.js 中 import 它\n\n```\nimport Index from './component/Index';\n```\n\n### 并添加到 Switch 标签里边\n\n```\n\u003cRoute path=\"/index\" component={Index} /\u003e\n```\n\n这样就能访问到对应的页面了\n\n## 添加全局数据和方法\n\n只供单个组件使用的数据写到 state 里边即可；多个组件用的数据写到 store/AppState.js 里边。\n\n```\n@observable var-you-added = \"EasyStarter\";  \n```\n\n之后可以直接在组件中调用：\n\n```\n{this.props.store.var-you-added}\n```\n\n对网络请求、文件写入等异步操作，应该全部写入到 AppState.js 中。需要使用 @action 修饰符，建议使用 async/await 来处理异步。\n\n```\n@action \n    async get_resume( id )\n    {\n        var params = new URLSearchParams();\n        params.append(\"id\" , id);\n        const { data } = await axios.post( 'http://o.ftqq.com/?m=resume\u0026a=detail' , params );\n\n        if( parseInt( data.code , 10 ) === 0  )\n        {\n            this.current_resume_id = data.data.id;\n            this.current_resume_title = data.data.title;\n            this.current_resume_content = data.data.content;\n        }\n        return data ;\n    }\n```\n## 自带 SCSS 支持\n\n可直接 import .scss 文件。\n\n\n## 自带 i18n 支持\n\n使用 react-i18n 进行国际化，配置见 ./i18n.js ，语言包文件在 ./public/locales 下，为 Json 格式。\n\n## 默认添加 DocumentTitle 设置页面 title\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasychen%2Feasy-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feasychen%2Feasy-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feasychen%2Feasy-starter/lists"}