脚本宝典收集整理的这篇文章主要介绍了Vue 教程第十三篇—— Vuex 之 state,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
<span>{{$store.state.count}}</span>
<span>{{count}}</span>
<script type="text/javascript">
computed: {
count(){
return this.$store.state.count
}
}
</script>
<span>{{count}}</span>
<script type="text/javascript">
import {mapState} from 'vuex';
computed: mapState({
count: state => state.count
})
</script>
<span>{{count}}</span>
<script type="text/javascript">
import {mapState} from 'vuex';
computed: mapState(['count'])
</script>
<span>{{count}}</span>
<script type="text/javascript">
import {mapState} from 'vuex';
computed: {
...mapState({
count: state => state.count
})
}
</script>
以上是脚本宝典为你收集整理的Vue 教程第十三篇—— Vuex 之 state全部内容,希望文章能够帮你解决Vue 教程第十三篇—— Vuex 之 state所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。