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 内容,请继续关注编程基础学习网。
织梦狗教程
本文标题为:vue3如何解决store.state.count错误的取值


基础教程推荐
猜你喜欢
- 原生Js实现元素渐隐/渐现(原理为修改元素的css透明度) 2024-02-08
- ajax请求后台得到json数据后动态生成树形下拉框的方法 2023-02-22
- vue父子组件传值不能实时更新的解决方法 2023-07-09
- vue相关面试知识点总结 2023-10-08
- 借助得力工具五分钟快速制作CSS导航菜单 2023-12-27
- JS弹出层遮罩,隐藏背景页面滚动条细节优化分析 2024-02-06
- html form表单基础入门案例讲解 2022-11-23
- js操作输入框提示信息且响应鼠标事件 2023-12-21
- docker-compose中nginx可以访问html无法访问php 提示File not found. ? 2023-10-25
- JavaScript 实现页面滚动动画 2023-12-11