前言:

  最近碰到一个问题需要对路由信息进行逻辑判断,但是我们的重定向文件都封装再一个js中,然后我又要使用 store 中方法,但是this.$store 显示 undefined 现在解决了 分享一下

解决方法:

  直接在当前的js中引入store

 

  

import store from '@/store';
//然后直接使用就好了
mutation:store.commit('xxx');
action: store.dispatch('xxx');
state: store.xx

  

相关文章:

  • 2021-08-03
  • 2021-11-19
  • 2021-05-27
  • 2022-12-23
  • 2022-01-24
  • 2021-10-06
  • 2022-02-08
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2022-01-27
  • 2021-08-26
  • 2021-06-21
  • 2022-12-23
  • 2021-11-06
相关资源
相似解决方案