这篇文章将为大家详细讲解有关Vue使用mapState时报错的解决方法,文章内容质量较高,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
1. 实践环境
Vue 2.9.6
2. 问题描述
<script> import { mapState } from 'vuex'; export default { name: "displayCount", computed: { ...mapState({ ...略 count: state => state.a.count }) }, methods: { increaseCount () { this.count = this.count + 1 } } }; </script> <style> </style>