?类型安全的运算符
// 控制台可以输出 item.title 内容
// 但是在html报错 Cannot read property 'title' of undefined
<ion-title>{{item.title}}</ion-title>
// 解决办法
<ion-title>{{item?.title}}</ion-title>
?类型安全的运算符
// 控制台可以输出 item.title 内容
// 但是在html报错 Cannot read property 'title' of undefined
<ion-title>{{item.title}}</ion-title>
// 解决办法
<ion-title>{{item?.title}}</ion-title>
本文标题:ionic3 ?类型安全的运算符
本文链接:https://www.haomeiwen.com/subject/lpjwgftx.html
网友评论