摘要: // 使用辅助函数前必须导入import { mapState , mapGetters, mapMutations, mapActions } from 'vuex'; (1) vuex 中 state 定义的数据 state: { msg: 'vuex中的数据' } 使用方法: 在组件(comp 阅读全文
posted @ 2020-11-24 20:45 Amerys 阅读(3768) 评论(0) 推荐(1)
摘要: 代码演示: 首先,我们假设state有以下数据 //类似组件data, 定义组件公共数据 state: { book: 'jQuery', }, 然后我们要在组价中修改book, 现在mutations中定义修改的方法 //类似组件methods, 定义修改state的方法 mutations: { 阅读全文
posted @ 2020-11-24 20:10 Amerys 阅读(4370) 评论(0) 推荐(1)