摘要:
<div>{{num}}</div> <button @click="add">++</button> <script>import SaleCard from "../../components/SaleCard.vue";import { mapState,mapActions } from ' 阅读全文
posted @ 2025-12-27 14:31
学无边涯
阅读(9)
评论(0)
推荐(0)
摘要:
<div>{{num}}</div> <button @click="add">++</button> <script>import { mapState, mapMutations } from "vuex";export default { name: 'HomeIndex', componen 阅读全文
posted @ 2025-12-27 14:13
学无边涯
阅读(10)
评论(0)
推荐(0)
摘要:
1,组件直接用 <div>{{$store.getters.doubleNum}}</div> 2, 计算属性用法 <div>{{doubleNum}}</div> computed:{ doubleNum(){ return this.$store.getters.doubleNum } } 3, 阅读全文
posted @ 2025-12-27 13:45
学无边涯
阅读(12)
评论(0)
推荐(0)
摘要:
1,组件直接用法 <div>{{$store.state.num}}</div> 2,计算属性里面用法 <div>{{num}}</div> computed:{ num(){ return this.$store.state.num } } 3,用mapState <div>{{num}}</di 阅读全文
posted @ 2025-12-27 13:41
学无边涯
阅读(11)
评论(0)
推荐(0)
摘要:
import Vue from 'vue' import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({ state:{ num:11 }, getters:{ }, mutations:{ }, actions:{ } } 阅读全文
posted @ 2025-12-27 13:28
学无边涯
阅读(9)
评论(0)
推荐(0)

浙公网安备 33010602011771号