使用vuex

const store = useStore()

store.commit("vuex的mutations定义的方法", 1)

如果出现 [vuex] unknown mutation type: xxx 的报错,是因为vuex分为几个模块,必须要在前面加上模块名,如store.commit(“模块名/方法名”)才可以获取到

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐