当耐特

Results 396 comments of 当耐特

1、请求应该放在store中还是model中进行? 我倾向于放到 store 中,model 只管数据注入,不管数据请求 2、假如在页面的onLoad中,我需要根据store的数据进行一些判断(store里的数据是需要请求获取到的),然而用this.data.xxx获取不到, a. getMetadata 是异步所以取不到啊 ```js async onLoad() { metadataStore.bind(this); await metadataStore.getMetadata(); // 这里获取不到webSitch if (this.data.webSwitch.near_jobs_status) { // do something } } ``` b.你不用到把逻辑写到 onLoad 里

看下的项目 https://github.com/Tencent/omi/tree/master/packages/omi-mp-create

非纯组件不要使用自己的 data

```JS store.onChange = function(diffResult){ //根据diffResult里的内容判断。里面有path的 } ```

推荐 omix https://github.com/Tencent/omi/tree/master/packages/omix

已经改了啊 https://github.com/Tencent/westore/blob/master/utils/diff.js