vuex拥有 user system 两个块,开启命名空间
模块中state在页面中的使用:
import { state } from "vuex"
computed: {
...mapState({ userInfo: state => state.user.userInfo })
}
模块中action的使用:
import { mapActions } from "vuex"
methods: {
...mapActions("user",["setUserInfo"])
}
模块中getters的使用
import { mapGetters } from "vuex"
computed: {
...mapGetters(user,["getUserInfo"])
}