import pano from "./module/pano"
export const store = new Vuex.Store({
modules: {
pano
}
})
// pano.js
const state = {
pano: null
}
at this point, when getting state, it is this.$store.state.pano.pano.xxx. How can I remove a layer of pano?
one of the current methods is in pano.js, which is written like this, but I have too many fields
// pano.js
const state = {
key1: "",
key2: ""
}
or do you want to traverse with for in?
// pano.js
const state = {
}
const mutations = {
updatePano: (state, payload) => {
for (const key in payload) {
state[key] = payload[key]
}
}
}