在一個組件中:export default{//錯誤寫法 data(){ return { topicList: this.$store.state.topicList } },//正確寫法 computed:{ topicList(){ return this.$store.state.topicList } }}在vuex的官方文檔中獲取state中的數據要使用后面的那種寫法,我想知道為什么?在這個組件中topicList沒有做任何計算,為什么要在computed中獲?。?
使用vuex,在組件中state數據的映射 為什么在computed里 而不能在data里?
汪汪一只貓
2018-10-12 14:09:28
