antdv 下拉框的 blur() 方法使用

嗷呜
代码

<template>
  <div>
    <a-select v-model:value="num" ref="selectVal" @change="onSelect">
      <a-select-option value="">--请选择--</a-select-option>
      <a-select-option value="1">1</a-select-option>
      <a-select-option value="2">2</a-select-option>
    </a-select>
  </div>
</template>

<script>
  import {
    ref,
  } from 'vue';

  export default defineComponent({
    setup() {
      const num = ref();
      const selectVal = ref();
      const onSelect = ()=>{
        selectVal.value.blur();
      }
      
      return {
        num,
        selectVal,
        onSelect
      }
    }
  });
</script>

<style>
</style>
Logo

前往低代码交流专区

更多推荐