vue3如何解决store.state.count错误的取值

854 ℃

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>

vue项目开发中一般会出现哪些报错?(vue常见的10种错误)

Vue项目开发中报“TypeError: Cannot read property 'yyy' of null”错误怎么解决?

Element UI中文官网Element Plus是一套基于Vue3.0的桌面端组件库

vue3项目如何正确引入新版高德地图(完整代码)

vue3相对于vue2有哪些新特性?

标签: store.state.count, vue3, vue报错

上面是“vue3如何解决store.state.count错误的取值”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。

当前网址:https://m.ipkd.cn/webs_4733.html

声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

PHP数组操作教程:如何高效移除数组中的空元素
wordpress如何清空批量/批量删除垃圾评论
jQuery如何获取图片高度和宽度
帝国cms教程之系统栏目字段管理
织梦cms提交文章后自动推送到百度站长平台