摘要: 四个map方法的使用 **mapState方法:**用于帮助我们映射state中的数据为计算属性 computed: { //借助mapState生成计算属性: sum、school、subject(对象写法) ...mapState({sum:'sum',school:'school',subje 阅读全文
posted @ 2022-03-11 20:34 苏槿年 阅读(847) 评论(0) 推荐(0) 编辑
摘要: getters的使用 1.概念:当state中的数据需要经过加工后再使用时,可以使用getters加工。 2.在store.js 中追加getters配置 ...... const getters = { bigSum(state){ return state.sum*10 } } //创建并暴露s 阅读全文
posted @ 2022-03-11 11:20 苏槿年 阅读(1826) 评论(0) 推荐(1) 编辑