猿问

v-for里如何读取store.state的值?

const store = new Vuex.Store({  state: {

    a: 'a'

  }

});
<li v-for="item in list">
    <img src="this.$store.state.a" />
</li>

为什么这个src没有被渲染?

very much Thanks in advance~~~


HUWWW
浏览 1507回答 1
1回答

小唯快跑啊

<img&nbsp;src="$store.state.a"&nbsp;/>你可以想成在&nbsp;template&nbsp;裡面的操作,就是在&nbsp;組件scope&nbsp;下。
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答