一、在mpvue中使用vuex
1、vue中使用vuex,在main.js中:
import store from './store'
new Vue({
store
})
2、mpvue中使用vuex,在main.js中:
import store from './store'
Vue.prototype.$store=store;//添加即可
补充:main.js
中引入store, 并绑定到Vue构造函数的原型上,这样在每个vue的组件都可以通过this.$store
访问store对象
二、Flyio