iview select 組件on-select事件(點擊item 改變原值)
<template>
<Select
ref="selectRef"
:value="userId"
filterable
remote
:remote-method="handleSelectOwner"
:loading="remoteLoading"
@on-select="handleSelectChoose"
>
<Option
v-for="option in ownerArr"
:value="option.value"
:key="option.value"
>{{option.label}}</Option>
</template>
<script>
data(){
return{
userId:'',
userName:'',
oldUserId:'',
oldUserName:''
}
}
handleSelectChoose(){
this.$refs.selectRef.values = [
{
value: this.oldUserId,
label: this.oldUserName
}
]
this.userId = this.oldUserId
this.$refs.selectRef.getInitialValue()
this.$refs.selectRef.isFocused = false
}
</script>