vue3如何解决store.state.count错误的取值
vue3语法中出现store.state.count
错误怎么解决,下面编程教程网小编给大家简单介绍一下正确写法!
正确写法如下:
<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>
以上是编程学习网小编为您介绍的“vue3如何解决store.state.count错误的取值”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。