store.js
export default new Vuex.Store({
state:{
globalNumber:0
},
modules:[a]
});
a.js
const state={
alocalNumber:0
}
export default {
state
}
a.vue
{{global}} -- {{local}}
mapState 这个方法到底有什么用,在modules 无效吗?请指教谢谢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你的
a.js没有导入吧?因为你的new Vuex.Store中,只有globalNumber,所以另外一个才先显示不了