vue中select选择框的监听事件
template模板:<el-select v-model="valueClass" placeholder="请选择学生" class="studentSelect"><el-optionv-for="item in classList":key="item.id&
template模板:
<el-select v-model="valueClass" placeholder="请选择学生" class="studentSelect">
<el-option
v-for="item in classList"
:key="item.id"
:label="item.className"
:value="item.teacherId">
</el-option>
</el-select>
script :
data:{
valueClass:' '
}
watch:{
valueClass (val, oldval) {
// console.log(this.classList[val]);
this.afterSwitchClassId = this.classList[val].classId;
this.afterSwitchTeacherId = this.classList[val].teacherId;
// console.log(this.afterSwitchClassId);
//console.log(this.afterSwitchTeacherId)
}
}
首先要在selecte选择框绑定初始值,然后监听绑定的数据
更多推荐
所有评论(0)