uni-app中Vuex的引用
//store 中 store.js import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state: { author: 'Youngmon' }, mutations: { author(state, newName) { state.author = newName; } }, actions: { } }) export default store /** //main.js 新增 import store from './store' Vue.prototype.$store = store //demo.vue this.$store.commit("author","yongmao"); computed: { author() { return this.$store.state.author } } */
漫人生路上,该放下的要放下,往事如过眼烟云,浅笑则安...