记录使用vue中踩到的坑(3):如何在router里调用store
在router.beforeEach()里无法直接使用this.$store.commit,解决方法很简单,导入即可:
import store from "../store/index";
然后调用时直接store.commit即可
在router.beforeEach()里无法直接使用this.$store.commit,解决方法很简单,导入即可:
import store from "../store/index";
然后调用时直接store.commit即可