vue.esm.js?efeb:591 [Vue warn]: Property or method "item" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class


 [Vue warn]: Property or method "item" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property. See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.

點擊刪除按鈕的時候報出的錯誤如圖所示:

父組件search.vue的源碼的delete是子組件search-list派發而來的自定義事件,該錯誤發生的原因是在deleteSearch中添加了item,而此時的item並沒有在data中定義,所以會報次錯誤,item是子組件search-list通過派發自定義事件delete時,傳過來的參數,在父組件的模版(template)中不需要寫,直接在 定義deleteSearch方法時帶入就可以了

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM