Ant Design Vue select 联动重置数据清空后不能渲染

清空后进行选择的时候 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
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值