我的info是一个对象,在页面中渲染的时候会直接报错 Cannot read property 'child' of undefined"
解决方法,单独定义一个变量,保存这个值。然后泻函数对这个值进行操作。
<select class="select-group1" v-model = "groupID1" v-on:change="clickChange(groupID1)" >
<option :value="item.id" v-for="item of groupArr" :key ="item.id" :index="item.id">{{item.name}}</option>
</select>
<select class="select-group2" v-model= "groupID2" v-if = "groupID2">
<option :value="childItem.id" v-for="childItem of secondChildArr" :key ="childItem.id" :index="childItem.id">{{childItem.name}}</option>
</select>
网友评论