在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ 計算屬性return props報undefined

計算屬性return props報undefined

props: ['item'],
computed: {
        coinPrice () {
            return this.item.currentPrice.toFixed(2)
        }
}

這里報this.item.currentPrice undefined,查了加載順訊,props在computed之前,為什么會報undefined?
值可以出來,先報undefined后在出來

回答
編輯回答
陌璃

that result from data request is async,so occur undefined error in first time render

2018年1月9日 10:22
編輯回答
心沉

寫法是沒錯的,可能是父組件的item.currentPrice沒有定義

2017年12月14日 14:55
編輯回答
風(fēng)畔

建議樓主debugger跟一下 會不會是prop中值本身有問題呢?

2018年8月21日 06:14
編輯回答
款爺

是不是item不是對象

2017年6月6日 19:27