Closed weixinfei123 closed 6 years ago
import Vue from 'vue' import Vuex from 'vuex' import vuexAlong from 'vuex-along'
// 公共数据管理 import com from './modules/common.js'
import home from './modules/home.js'
import cardpageinfo from './modules/cardPageInfo.js'
import usercenter from './modules/usercenter.js'
import addOilCard from './modules/add_oil_card.js'
Vue.use(Vuex);
vuexAlong.watch([com.state.test], true)
export default new Vuex.Store({ modules: { com, home, cardpageinfo, usercenter, addOilCard }, plugins: [vuexAlong] })
我只想保存com.state.test这个数据,vuexAlong.watch([com.state.test], true) 这样写不起作用,第一次用,请问这个该怎么处理了,谢谢!
直接模块名就好啦 vuexAlong.watch([‘test’], true) 记得带引号
vuexAlong.watch([‘test’], true)之前试过呀,刚刚也试了一下,还是不行了,刷新后还是变回初始值
vuexAlong.watch([‘com’], true)这样就可以了,刚才是模块名搞错了,谢谢
import Vue from 'vue' import Vuex from 'vuex' import vuexAlong from 'vuex-along'
// 公共数据管理 import com from './modules/common.js'
import home from './modules/home.js'
import cardpageinfo from './modules/cardPageInfo.js'
import usercenter from './modules/usercenter.js'
import addOilCard from './modules/add_oil_card.js'
Vue.use(Vuex);
vuexAlong.watch([com.state.test], true)
export default new Vuex.Store({ modules: { com, home, cardpageinfo, usercenter, addOilCard }, plugins: [vuexAlong] })
我只想保存com.state.test这个数据,vuexAlong.watch([com.state.test], true) 这样写不起作用,第一次用,请问这个该怎么处理了,谢谢!