// Scrrenshot
<div v-for='(place) in qury.visitPlaces' :key="place.name">
<div class="column is-4 is-narrow">
<b-field label="Nights">
<b-input type="text" v-model="place.nights" placeholder="e.g. Bandra" required></b-input>
</b-field>
</div>
<div class="card hotel-card" v-for='(hotel, index) in place.hotels' :key="hotel.name">
<header class="card-header">
<b-tooltip label="Delete Hotel" position="is-left">
<a class="card-header-icon" aria-label="Delete Hotel" @click="removeHotel(index)">
<span class="icon">
<i class="far fa-trash-alt"></i>
</span>
</a>
</b-tooltip>
</header>
</div> </div>
// Javascript
removeHotel(index) {
console.log(index);
this.qury.hotels.splice(index, 1);
//this.priceList = {};
},
未捕获的类型错误:无法读取未定义的属性'splice'。这些错误继续发生。请帮助我。
答案 0 :(得分:0)
这意味着this.qury.hotels未定义。因此,如果出现以下情况,请添加
OtherInfo ::= SEQUENCE {
keyInfo KeySpecificInfo,
partyAInfo [0] OCTET STRING OPTIONAL,
suppPubInfo [2] OCTET STRING
}
KeySpecificInfo ::= SEQUENCE {
algorithm OBJECT IDENTIFIER,
counter OCTET STRING SIZE (4..4) }
答案 1 :(得分:0)
您曾期望this.qury.hotels
是一个数组,但是在调用函数时并未将其定义为一个。
您可以使用静态.isArray
方法来测试变量是否为数组
function removeHotel(index) {
if(Array.isArray(this.qury.hotels) && this.qury.hotels.length > 0) {
this.qury.hotels.splice(index, 1);
}
}