摘要:
1、当state中的数据需要加工使用时,可以使用getters加工 2、在sindex.js中追加getters配置,注意别忘记创建和暴露 //准备state对象--保存具体数据 const state = { sum:0 } // 对state中的数据进行加工处理 const getters = 阅读全文
posted @ 2025-01-07 19:36
市丸银
阅读(59)
评论(0)
推荐(0)
摘要:
1、index.js import Vue from "vue"; import Vuex from "vuex" // 使用Vuex Vue.use(Vuex) // 准备actions对象--响应组件中的动作 const actions = { addOdd(context, value){ i 阅读全文
posted @ 2025-01-07 18:51
市丸银
阅读(5)
评论(0)
推荐(0)
摘要:
一、下载vuex 注意版本 vue2对应 npm i vuex@3 vue3对应 npm i vuex@4 二、创建文件 src/store/index.html import Vue from "vue"; import Vuex from "vuex" // 使用Vuex Vue.use(Vue 阅读全文
posted @ 2025-01-07 18:05
市丸银
阅读(9)
评论(0)
推荐(0)

浙公网安备 33010602011771号