wepy2的package.json
"@wepy/core": "^2.0.0-alpha.16",
"@wepy/x": "^2.0.2"
在mixins中使用 mapState
import { mapState, mapActions } from '@wepy/x'
export default {
computed: {
...mapState([ 'UserInfo' ])
},
methods: {
...mapActions(['storeSaveUserInfo'])
},
created() {}
}
wepy页面正常使用需要同时导入 common 和 stroe文件
<script>
import commonMixins from '@/mixins/common'
import store from '@/store'
wepy.page(
store,
mixins: [commonMixins]
)}
</script>
若只导入common不引入stroe则报错
点击 at WepyPage.mappedState (vendor.js?[sm]:4765) 跳转发现
this.$store.state 和 this.$store.getters 问题