当前位置:网站首页>TypeError: Cannot read properties of undefined (reading ***)
TypeError: Cannot read properties of undefined (reading ***)
2022-07-03 00:11:00 【Z_ Xshan】
I read several versions elsewhere
Version of a
1. Check your data Does the defined attribute not have the attribute you use , If not, define a , as follows :
#template
<div class="he-info__item">
<span class="he-label"> Name of consignee :</span>
<span class="he-value">{
{ detail.buyer.name }}</span>
</div>
<div class="he-info__item">
<span class="he-label"> Contact information :</span>
<span class="he-value">{
{ detail.buyer.mobile }}</span>
</div>
#js
export default {
data () {
detail: {
buyer: {
name: "",
mobile: "",
},
user: {
nickname: "",
},
},
}
}
Version 2
//2. It may also be that the data returned to you by the backend does not have this attribute perhaps Some of the returned data There are plenty of them null ,
// You can't write at this time {
{ item.xxx || “” }} Otherwise, it will report a mistake Cannot read properties of undefined (reading ‘xxx‘)“ It can be solved like this as follows :
#template
<div v-if="!!item.invite">{
{ item.invite.nickname }}</div> // Only when this attribute is present
// Or so it goes
<div v-if="item?.invite">{
{ item.invite.nickname }}</div> // Only when this attribute is present
<div v-else>{
{ "" }}</div> // No return perhaps null Directly fill in “”
Version 3
//3. There is another kind on the Internet View not updated Data has not been returned You start using this property You can add
this.$nectTick (()=>{// get data }) Wrap it
If there is no code error in my solution, you can download it again and try it
hold node_modules Delete and
npm i
or
cnpm i
If the download package is wrong when starting the project Then this method is a little cuddly
We can try src Next .umi Delete the file
Then download the dependency package that reports an error
Then start the project !!!
边栏推荐
- Interpretation of new plug-ins | how to enhance authentication capability with forward auth
- Program analysis and Optimization - 9 appendix XLA buffer assignment
- How QT exports data to PDF files (qpdfwriter User Guide)
- @How to use bindsinstance in dagger2
- 一文掌握基于深度学习的人脸表情识别开发(基于PaddlePaddle)
- [Verilog tutorial]
- Unique line of "Gelu"
- 67页新型智慧城市整体规划建设方案(附下载)
- JDBC教程
- AcWing_188. 武士风度的牛_bfs
猜你喜欢
[shutter] shutter open source project reference
Create an interactive experience of popular games, and learn about the real-time voice of paileyun unity
[shutter] open the third-party shutter project
CADD课程学习(4)-- 获取没有晶体结构的蛋白(SWISS-Model)
写论文可以去哪些网站搜索参考文献?
JDBC教程
Why can't the start method be called repeatedly? But the run method can?
MySQL基础
JDBC tutorial
Highly available cluster (HAC)
随机推荐
What are the projects of metauniverse and what are the companies of metauniverse
Highly available cluster (HAC)
collections. What is the purpose of chainmap- What is the purpose of collections. ChainMap?
QT 如何将数据导出成PDF文件(QPdfWriter 使用指南)
JDBC Exercise case
[shutter] shutter photo wall (center component | wrap component | clickrrect component | stack component | positioned component | button combination component)
Integration of revolution and batch normalization
Digital twin visualization solution digital twin visualization 3D platform
Several methods of the minimum value in the maximum value of group query
Define MySQL function to realize multi module call
How to apply for company email when registering in company email format?
cocospods 的使用
JS interviewer wants to know how much you understand call, apply, bind no regrets series
Returns the size of the largest binary search subtree in a binary tree
[shutter] open the third-party shutter project
Program analysis and Optimization - 9 appendix XLA buffer assignment
Digital twin smart factory develops digital twin factory solutions
How to set automatic reply for mailbox and enterprise mailbox?
Architecture: load balancing
zhvoice