页面在使用invoice.js的mutations中方法时需要加上模块名,如图所示。

<script>
	import {mapState,mapMutations} from 'vuex'
	export default {
		data() {
			return {
				invoiceData: {}
			}
		},
		computed: {
			...mapState({
				picker:state=>state.invoice.picker
			}),
			pickerIndex: {
				get() {
					return this.$store.state.invoice.pickerIndex;
				},
				set(val) {
					this.$store.state.invoice.pickerIndex = val
					this.$store.commit("invoice/formData", {
						val: val,
						id: 1
					});
				}
			}
		}
		
	}
</script>

其他情况需要检查拼写问题或检查invoice.js中namespaced:true是否设置

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐