初學前端,在學習vue時遇到如下問題:這邊需要兩個List,兩個List顯示不同內(nèi)容,我打算用兩個for循環(huán)解決這個問題。然后我寫了如下代碼,第一個list正常顯示,第二個出了錯不顯示。Html{{searchItem.name}}{{mailItem.name}}jsvarone=newVue({el:"#list",data:{searchItems:[{name:'Baidu',url:'https://www.baidu.com'},{name:'Bing',url:'https://www.bing.com'},{name:'360',url:'https://www.so.com'}]}});vartwo=newVue({el:"#list",data:{mailItems:[{name:'126',url:'https://www.126.com/'},{name:'163',url:'https://www.163.com/'},{name:'Yeah',url:'https://www.yeah.net/'}]}});錯誤提示vue.js:634[Vuewarn]:Propertyormethod"mailItems"isnotdefinedontheinstancebutreferencedduringrender.Makesurethatthispropertyisreactive,eitherinthedataoption,orforclass-basedcomponents,byinitializingtheproperty.See:https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.(foundin)不知道哪里出錯了,兩個Vue分別注釋其中一個也都能正常運行,然后自己也嘗試了很多方法也沒能解決,還請大家?guī)兔匆幌拢x謝!
有沒有人遇到過這個問題哈!Vue中循環(huán)出現(xiàn)is not defined無法取出數(shù)據(jù)
瀟湘沐
2019-09-12 21:14:23