When rendering a page with v-for, what do you do if one of the values you want to take may not exist key?

<li class="find-list-li" v-for="item in carSenseFindData" :key="item.index">
    <div class="img-box">
       <img :src="item.vehicleInOutPic[0]["platePic"] | transferPic" :onerror="defaultPeopleImg">
    </div>
</li>

for example, the platePic field to be fetched may not exist, and if the vehicleInOutPic array is empty, an error will be reported at that time, and it will not work either. Is there any convenient way to correct it? You still have to go through the data processed by carSenseFindData

.
Dec.23,2021

you add a ternary to determine whether the previous vehicleInOutPic is empty
your guarantee field can determine that your block is a value error


just the ternary operator

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3db67-2c3af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3db67-2c3af.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?