Vuex namespaced

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]
    }
  }
}
May.25,2022

should not be lost, the first layer represents the module name, the second layer represents the attribute name, if you think it is long, use mapState.


use mapState abbreviation

computed: {
    ...mapState('pano', ['pano'])
}

use
this.pano.xxx

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b351a4-2bf4c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b351a4-2bf4c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?