Ant Design Vue select 联动重置数据清空后不能渲染
清空后进行选择的时候 editForm.recipient 是有值的,this.$forceUpdate() 强制更新数据就好了<a-selectallow-clearplaceholder="请选择接收类型"v-model="editForm.recipientType"@change="changeRecipientType"><a-select-option :value=
·
清空后进行选择的时候 editForm.recipient 是有值的,this.$forceUpdate() 强制更新数据就好了
<a-select
allow-clear
placeholder="请选择接收类型"
v-model="editForm.recipientType"
@change="changeRecipientType">
<a-select-option :value="1">全部用户</a-select-option>
<a-select-option :value="2">教师</a-select-option>
<a-select-option :value="3">学生</a-select-option>
</a-select>
<a-select
allow-clear
mode="multiple"
:placeholder="recipientPlaceholder"
v-model="editForm.recipient"
@change="changeRecipient">
<a-select-option v-for="item in recipientNameList" :key="item.id">
<span v-if="editForm.recipientType === 2">
{{item.username}}
</span>
</a-select-option>
</a-select>
// 接收人
changeRecipient(value) {
this.editForm.recipient = value
this.$forceUpdate()
},
// 接收人类型
changeRecipientType(value) {
// 清空select缓存数据
this.recipientNameList = []
this.editForm.recipient = []
this.$forceUpdate()
// 1全部用户 2教师 3学生
if(value === 1) {
this.getUserList()
} else if(value === 2) {
this.recipientPlaceholder = '请选择教师'
this.getTeacherList()
} else if(value === 3) {
this.recipientPlaceholder = '请选择学生'
this.getStudentList()
}
},
更多推荐
已为社区贡献1条内容
所有评论(0)