import pano from './module/pano'export const store = new Vuex.Store({ modules: { pano } }) // pano.jsconst state = { pano: null} 此时,获取state的时候是this.$store.state.pano.pano.xxx,如何才能去除一层pano?目前其中一个方法是在pano.js里,如下这样书写,但是我的字段太多了// pano.jsconst state = { key1: '', key2: ''}还是用for in遍历?// pano.jsconst state = {}const mutations = { updatePano: (state, payload) => { for (const key in payload) { state[key] = payload[key] } }}
守候你守候我
相关分类