想将一个对象数据存入vuex,但是发现没办法写入,想知道错在哪
/**
* 存放跳转数据
* **/
// initial state
const state = {
all: {
companyId: ''
}
}
// getters
const getters = {}
// actions
const actions = {}
// mutations
const mutations = {
setPrint: (state, all) => { // 设置参数
state.all = all
}
}
export default {
namespaced: true,
state,
getters,
actions,
mutations
}
this.$store.commit('print/setPrint', { // print 表示vuex的文件名
companyId: row.companyId
})
直接使用看下,好像state和getters才需要包名,actions与mutations不需要