摘要: 1. 概念:当state中的数据需要经过加工后再使用时,可以使用getters加工。 2. 在```store.js```中追加```getters```配置 ```js ...... const getters = { bigSum(state){ return state.sum * 10 } 阅读全文
posted @ 2023-08-27 01:54 雪落无痕1 阅读(29) 评论(0) 推荐(0)
摘要: 1. 初始化数据、配置```actions```、配置```mutations```,操作文件```store.js``` ```js //引入Vue核心库 import Vue from 'vue' //引入Vuex import Vuex from 'vuex' //引用Vuex Vue.use 阅读全文
posted @ 2023-08-27 01:25 雪落无痕1 阅读(17) 评论(0) 推荐(0)
摘要: 1.store/index.js //改文件用于创建vuex 最为核心的 store import Vue from 'vue' //引入vuex import Vuex from 'vuex' Vue.use(Vuex) // 准备actions 用于响应组件中的动作 const actions= 阅读全文
posted @ 2023-08-27 01:24 雪落无痕1 阅读(13) 评论(0) 推荐(0)