废话不多说,直接上代码
<script setup lang="ts">
import { computed } from "vue";
import { mapActions, mapGetters, mapMutations, mapState, useStore } from "vuex";
const store = useStore();
const [abc, list] = Object.values(mapState("user", [ "abc", "list"])).map(it=>computed(it.bind({$store:store})))
const [getList] = Object.values(mapGetters("user", [ "getList"])).map(it=>computed(it.bind({$store:store})))
const [incre] = Object.values(mapMutations("user", [ "incre"])).map(it=>(it.bind({$store:store})))
const [decre, getUser] = Object.values(mapActions("user", [ "decre","getUser"])).map(it=>it.bind({$store:store}))
<script>