vuex中mapState问题
发布于 9天前 作者 vue-1157317257 154 次浏览 来自 问答

<template>

{{msg}}

{{$store.state.count}}----{{count}}

</template> <script> import {mapState} from '../vuex/store' export default { name: 'HelloWorld', data () { return { msg: 'vuex' } }, computed: { ...mapState([ 'count' ]) } } </script> 提示...mapState([]) 不函数----> Uncaught TypeError: Object(...) is not a function,哪位大神指导一下
3 回复

computed:mapState([‘account’])这样试试看

@FastTurbo 不对呀 终端提示:export ‘mapState’ was not found in ‘…/vuex/store’

import { mapState } from 'vuex';

回到顶部