当前位置:网站首页>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 !!!
边栏推荐
- Judge whether the binary tree is full binary tree
- yolov5test. Py comment
- 洛谷_P2010 [NOIP2016 普及组] 回文日期_折半枚举
- Slf4j + Logback日志框架
- 来自数砖大佬的 130页 PPT 深入介绍 Apache Spark 3.2 & 3.3 新功能
- Digital twin visualization solution digital twin visualization 3D platform
- Convolution和Batch normalization的融合
- leetcode 650. 2 keys keyboard with only two keys (medium)
- JSON数据传递参数
- Create an interactive experience of popular games, and learn about the real-time voice of paileyun unity
猜你喜欢
Improvement of RTP receiving and sending PS stream tool (II)
JDBC教程
Explain in detail the process of realizing Chinese text classification by CNN
QT 如何将数据导出成PDF文件(QPdfWriter 使用指南)
实用系列丨免费可商用视频素材库
论文的英文文献在哪找(除了知网)?
[shutter] open the third-party shutter project
Bean load control
Highly available cluster (HAC)
Speech recognition Series 1: speech recognition overview
随机推荐
sourcetree 详细
yolov5test. Py comment
How to specify const array in the global scope of rust- How to specify const array in global scope in Rust?
[shutter] shutter photo wall (center component | wrap component | clickrrect component | stack component | positioned component | button combination component)
MFC文件操作
顶级 DevOps 工具链大盘点
MySQL advanced learning notes (4)
Additional: token; (don't read until you finish writing...)
[Verilog tutorial]
Intranet penetration | teach you how to conduct intranet penetration hand in hand
leetcode 650. 2 keys keyboard with only two keys (medium)
QT 如何将数据导出成PDF文件(QPdfWriter 使用指南)
Agnosticism and practice makes perfect
sysdig分析容器系统调用
Open Source | Wenxin Big Model Ernie Tiny Lightweight Technology, Accurate and Fast, full Open Effect
67页新型智慧城市整体规划建设方案(附下载)
英文论文有具体的格式吗?
Installing redis under Linux
Bean加载控制
Returns the root node of the largest binary search subtree in a binary tree