记一些使用mpvue时遇到的问题

一、在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

猜你喜欢

转载自www.cnblogs.com/huangfeihong/p/11267437.html