store里的数据分成模块后,mapState辅助函数里应该怎么引模块的数据?
store文件结构:
- src
- components
- store
- index.js
- modules
- carts.js
store中index.js代码:
modules: {
carts,
}
template代码:
<div style="margin-top:20px;">
{{price}}
</div>
辅助函数代码:
computed: {
...mapState({
price: state => state.carts.price;
})
}