2024年06月11日 建站教程
vue3语法中出现store.state.count
错误怎么解决,下面web建站小编给大家简单介绍一下正确写法!
正确写法如下:
<script setup lang="ts"> import { useStore } from '@/vuex'; import {computed} from 'vue' const store = useStore() const onSubmit = () => { store.dispatch("incrementAction", 1); } let num = computed(() => store.state.count) </script> <template> <h2 @click="onSubmit">{{ count }}</h2> <h2>{{$store.state.count}}</h2> </template>
本文链接:http://so.lmcjl.com/news/6350/