Add anaOptions Moduel

This commit is contained in:
2022-06-10 15:29:44 +08:00
parent 77e1158f8b
commit 37ca848bb6
4 changed files with 85 additions and 38 deletions

View File

@@ -1,24 +1,31 @@
<template>
<div>
<div>这是box组件测试,test</div>
<button @click="divide(2)">除2</button>
<div>count的值为{{count}}</div>
</div>
<div>
<h3>当前最新的count的值为{{ count }}</h3>
<button @click="divide(2)">除2</button>
<ul>
精神语录列表
<button @click="axiosGetAna">请求并添加语录</button>
<li v-for="i in analist" :key="i.id">{{ i.ana }}</li>
</ul>
</div>
</template>
<script>
import {mapState} from 'vuex'
import { mapState,mapMutations,mapActions } from "vuex";
export default {
data(){
return{ }
data() {
return {};
},
methods: {
divide(num) {
this.$store.commit("countOptions/divide", num);
},
methods:{
divide(num){
this.$store.commit('countOptions/divide',num)
}
},
computed:{
...mapState('countOptions',['count'])
}
}
...mapMutations("anaOptions",['addanalist']),
...mapActions("anaOptions",['axiosGetAna'])
},
computed: {
...mapState("countOptions", ["count"]),
...mapState("anaOptions", ["analist"]),
},
};
</script>

View File

@@ -1,27 +1,29 @@
<!--moguyun-->
<template>
<div>
<h3>当前最新的count值为{{count}}</h3>
<button @click="subN(2)">-2</button>
<button @click="xc(10)">*10</button>
<button @click="subNAsync(10)">-10 Async</button>
<h3>{{showNum1}}</h3>
</div>
<div>
<h3>当前最新的count值为{{ count }}</h3>
<button @click="subN(2)">-2</button>
<button @click="xc(10)">*10</button>
<button @click="subNAsync(10)">-10 Async</button>
<h3>{{ showNum1 }}</h3>
<h2>当前语录列表中的总条数为{{ showListLength }}</h2>
</div>
</template>
<script>
import { mapState,mapMutations,mapActions,mapGetters } from "vuex";
import { mapState, mapMutations, mapActions, mapGetters } from "vuex";
export default {
data(){
return{ }
},
methods:{
...mapMutations('countOptions',['subN','xc']),
...mapActions('countOptions',['subNAsync']),
},
computed:{
...mapState('countOptions',['count']),
...mapGetters('countOptions',['showNum','showNum1'])
}
}
data() {
return {};
},
methods: {
...mapMutations("countOptions", ["subN", "xc"]),
...mapActions("countOptions", ["subNAsync"]),
},
computed: {
...mapState("countOptions", ["count"]),
...mapGetters("countOptions", ["showNum", "showNum1"]),
...mapGetters("anaOptions", ["showListLength"]),
},
};
</script>