# mobx-demo **Repository Path**: beiysd/mobx-demo ## Basic Information - **Project Name**: mobx-demo - **Description**: mobx-简单模板 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2019-11-28 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## mobx-demo ## 结构 ``` src -api 请求接口 -components 公共组件 -pages 页面 -store 调用api,数据处理(新建文件要在index.js中绑定) -utils 公共方法 -App.js 路由 -setupProxy.js 设置代理 ``` ## 01: 设置代理 src/setupProxy.js `注意: 此处使用proxy,需安装mobx@4.x` ## 02: 路由 App.js `此处使用了懒加载 Lazy,Lazy放在components中` ## 03: 页面 page (需要注入关联 store) ## 04: 请求方法 api (get,post 方法在 utils/axios 中) ## 05: 调用 api 处理数据 store ## 06: 'alias', `config/webpack.config.js` `添加 '@':path.resolve(__dirname,'../src')`, `创建文件 jsconfig.json` ``` { "compilerOptions": { "experimentalDecorators": true, "baseUrl": ".", "paths": { "@/*": ["src/*"] }, "jsx": "react" }, "exclude": ["node_modules", "build", "config", "scripts"] } ``` ## 07: '@' `修饰符引入,在package.json添加` ``` "babel": { "plugins": [ [ "@babel/plugin-proposal-decorators", { "legacy": true } ] ], "presets": [ "react-app" ] } ``` ## 08 api 地址更改 需要自行补充