關於Vue報錯(Property or method “xxx“ is not defined on the instance but referenced during render.)防踩坑
今天記錄一下這個問題,在用vue寫前端,在頁面取值的時候,發現控制檯一直報錯
控制檯報錯資訊:
錯誤資訊:屬性或方法“peoples”不是在例項上定義的,而是在渲染過程中被引用的。 通過初始化屬性,確保此屬性是反應性的,無論是在資料選項中,還是對於基於類的元件。
所以,由此我們就知道了,在vue的template中我們使用了peoples資料,但是在data中還並沒有被定義,就被使用了,造成了這個錯誤。在data中定義一下這個peoples的資料,就可以解決這個問題了。
前端程式碼:
呼叫資料方法:
資料存放 data :
在這個問題中,因為peoples和formData是不同的資料來源,peoples不屬於formData,因此不能寫在它的裡面,所以應該更改為
這樣子就可以正常獲得我們所需要的資料,頁面就可以正常顯示了
如果還是有問題的話,就在元件前面或者本身加一個v-if,讓data渲染完成再執行
相關推薦
關於Vue報錯(Property or method “xxx“ is not defined on the instance but referenced during render.)防踩坑
今天記錄一下這個問題,在用vue寫前端,在頁面取值的時候,發現控制檯一直報錯
Property or method "info" 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,
原始碼 App.Vue <template> <div> <test v-for=\"post in posts\" v-bind:title=\"post.title\">
vue/cli建立的typescript專案,引入less一直報錯Syntax Error: TypeError: this.getOptions is not a function
技術標籤:一些學習的研究新手入門vuetypescript 錯誤提示如下 Syntax Error: TypeError: this.getOptions is not a function
解決大於5.7版本mysql的分組報錯Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated
原因: MySQL 5.7.5和up實現了對功能依賴的檢測。如果啟用了only_full_group_by SQL模式(在預設情況下是這樣),那麼MySQL就會拒絕選擇列表、條件或順序列表引用的查詢,這些查詢將引用組中未命名的非聚合列,而不
Selenium報錯:element click intercepted: Element is not clickable at point ,Other element would receive
技術標籤:pythonseleniumpython 錯誤日誌: selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element xxxis not clickable at point (374, 25). Other ele
今天遇到個bug,分享一下js報錯:Uncaught TypeError: i.push is not a function
//配置自動轉換cookie的JSON格式資料 $.cookie.json=true //讀取儲存在cookie中的購物車陣列
http://10.18.5.83:8080/ 瀏覽報錯:A default document is not configured for the requested URL, and directory browsing is not enabled on the server
http://10.18.5.83:8080/瀏覽報錯:A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
jquery.js檔案引入出錯Uncaught ReferenceError: XXX is not defined
技術標籤:前後端jqueryjavascripthtml5 jquery.js檔案引入出錯Uncaught ReferenceError: XXX is not defined
vscode中的vue專案報錯Property ‘xxx‘ does not exist on type ‘CombinedVueInstance<{ readyOnly...Vetur(2339)
問題描述: 今天早上一開機,開啟專案,發現專案一片醒目的紅色,檢視報錯原因提示:
Vue——解決報錯 Computed property "****" was assigned to but it has no setter.
在最近的專案中遇到了如下的警告資訊: [Vue warn]:Computed property \" currentStep\" was assigned to but it has no setter.(意思是:計算屬性 currentStep被賦值了,但此它並未定義 set方法 。)
Vue報錯:Computed property “XX“ was assigned to but it has no setter.解決方法
技術標籤:vuevuejs Vue報錯:Computed property “XX” was assigned to but it has no setter. 【程式碼背景】
報錯package xxx is not in GOROOT or GOPATH 或者 cannot find package “xxx“ in any of
GO111MODULE=“off” 在GO111MODULE=\"off\"的條件下,並且寫的程式碼不在$GOPATH/src下,也就是說下面的main.go不在$GOPATH/src目錄下面,同時我想要使用另一個module裡面的內容,並且這個module不是標準庫,或者說
vue報錯資訊(Avoid using non-primitive value as key, use stringnumber value instead.)
避免使用非原始值作為關鍵字,而使用字串/數字值代替。 解決方法: <el-carousel class=\"swiper-container\" :interval=\"5000\" arrow=\"hover\" @change=\"carouselItem\">
React之React-eslint報錯(React Hook "useEffect" is called in function "routeClass3" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks)
1.eslint去掉註釋報錯:// eslint-disable-next-line react-hooks/rules-of-hooks 在使用react hook時會遇到一些問題,就是在使用hook的一些api時就會出現如下所示報錯,使用vscode的自動修復就是加上註釋,但是每
hadoop叢集格式化namenode報錯(dfs.namenode.shared.edits.dir )
hadoop叢集格式化namenode報錯************************************************************/20/08/05 10:34:11 INFO namenode.NameNode: registered UNIX signal handlers for [TERM, HUP,INT]20/08/05 10:34:11
vue報錯:'XX' is defined but never used no-unused-vars
參考地址:http://www.gold404.cn/info/87 導致這個報錯的原因就是eslint校驗, 就是你當初在vue建立腳手架的時候選擇了eslint校驗;
vue報錯webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
原因:新版的webpack-dev-server 3.1.14 存在問題。 解決方法:package.json 中指定 webpack-dev-server 低版本號
Eclipse 匯入專案 .json 檔案報錯(出現小紅叉)
>>> 使用 eclipse 匯入一個 Maven 專案之後,裡面的 .json 檔案報錯出現小紅叉!
郭全蛋的安卓筆記-無法編譯報錯(WARNING: Uninstalling will remove the application data!)解決方案大全!
無法編譯報錯WARNING: Uninstalling will remove the application data! 想必大家在寫安卓專案的時候都會遇到這種報錯資訊。
2020-10-20 activiz報錯(System.Exception: error: could not get registered type.)
報錯原因 自定義了一些滑鼠事件,由於vtkInteractorStyleTrackballCamera沒有定義成全域性變數。在呼叫其他函式之後,c#對觸發事件的物件的引用超出範圍。 補充 應該vtkRenderWindowInteractor相關的均應定