vue-cli整合vuex的时候,修改actions和mutations,实现热部署

在store.js里面添加如下的代码就可以了:

// 热重载
if (module.hot) {
  // 指定要监控的文件
  module.hot.accept(['./mutations'], () => {
    const mutations = require('./mutations').default
    // Vuex 提供的热重载接口
    store.hotUpdate({
      mutations
    })
  })
}

猜你喜欢

转载自blog.csdn.net/s8460049/article/details/53812199