xiaoyao96/wxMiniStore

使用App.Page,页面直接空白

atom-7 opened this issue · 3 comments

我在index页面使用是App.Page() 创建页面,页面加载不了直接空白了,怎么解决

需要在app.js 第一行引入并初始化后才能使用:

import Store from 'wxministore'
const store = new Store({
   ...
})
App({...});

或者创建一个目录store/index.js

// store/index.js
import Store from 'wxministore'
export default new Store({
    ...
});

// --------------------------------------
// 以下为app.js
import store from './store/index.js'
App({
  store,
  ...
})

以上两种方式引入后,才能在其他页面或组件里,使用App.Page 和 App.Component