在Vue中定義方法或者屬性時,因為粗心疏忽可以能會報該錯誤
[Vue warn]: Property or method "search" 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.
屬性或方法“search”不是在實例上定義的,而是在呈現期間引用的。通過初始化該屬性,確保該屬性是反應性的,無論是在data選項中,還是對於基於類的組件。
可以檢查三個方面:
1.是否將該屬性或方法放在 methods 中,尤其是methods 有沒有寫對。
2.在methods中是否定義了該方法。
3.如果方法中傳了參數,這個參數有沒有在 data 中 設置默認值
以上三方面沒有解決:methods 中的方法的放的位置是否正確,括號太多了,可能發生嵌套錯誤。