第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關于vue vuex mapState created執(zhí)行順序?

關于vue vuex mapState created執(zhí)行順序?

哈士奇WWW 2018-07-05 15:15:38
A組件:   存儲:localStorage.setItem('articles', JSON.stringify(articles)) B組件: computed: {       ...mapState([          "articles"       ])   },   created(){        var currentId = parseInt(this.$route.query.id);        this.currentArticle = this.articles.filter((item)=>{        return item.id === currentId            });        this.isCollected = this.currentArticle[0].isCollected;        this.collectNum = this.currentArticle[0].collectNum;         console.log(this.currentArticle)   }, vuex: state.js:  articles:localStorage["articles"]?JSON.parse(localStorage["articles"]): []進入A組件后,調(diào)用接口,請求回數(shù)據(jù)后,存到localStorage中,點擊路由跳轉到B組件,為什么在created()中 this.articles 為 [],頁面上沒有數(shù)據(jù),當我進入B組件后再次刷新頁面就有數(shù)據(jù)了,這里面的computed()和 created()是不是有執(zhí)行順序的問題?應該怎么解決這個問題呢?
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 2693 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號