摘要:
有时候,需要从store中获取一些state变化之后的数据,这是可以放入getters中 下面例子:获取年龄大于20的学生数据 注: getters默认是不能传递参数的,如果希望传递参数,那么只能让getters本身返回一个函数 阅读全文
posted @ 2022-11-25 22:35
iTao0128
阅读(24)
评论(0)
推荐(0)
摘要:
通过mutations修改state状态 mutations中的方法必须是同步方法 this.$store.commit('mutations中的方法') const store = new Vuex.Store({ state: { counter: 100 }, mutations: { //方 阅读全文
posted @ 2022-11-25 17:42
iTao0128
阅读(31)
评论(0)
推荐(0)
摘要:
安装 npm install vuex --save 创建store文件夹及index.js文件 import Vue from 'vue' import Vuex from 'vuex' //1.安装插件 Vue.use(Vuex) //2.创建对象 const store = new Vuex. 阅读全文
posted @ 2022-11-25 15:52
iTao0128
阅读(25)
评论(0)
推荐(0)

浙公网安备 33010602011771号