<template>
<el-input
v-model="msg"
id="inputbox"
type="text"
style="width: 500px"
/>
<el-button @click="handleGetFocus">获取焦点</el-button>
</template>
<script setup lang="ts">
import { ref } from "vue";
let msg = ref("获取焦点")
const handleGetFocus = () => {
document.getElementById("inputbox")?.focus();
}
</script>