功能实现:
打开弹窗,弹窗中的输入框内容自动选中,且为全选
Filmage 2021-12-02_152240.gif

创建ref

const inputRef = ref<HTMLInputElement>(null);

在弹窗打开时,调用ref

const showEditModal = () => {
  visible.value = true;
  nextTick(() => {
    inputRef.value.focus();
    inputRef.value.select();
  });
};
        <a-input ref="inputRef" v-model:value="formState.name" autocomplete="off" placeholder="请输入分组名称" />
nextTick在vue3中可以直接引入
import { nextTick } from "vue";