iview select 組件on-select事件(點擊item 改變原值)

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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章