vue3 实现 input 输入框聚焦
在 template 标签内写入 input 输入框
<el-input style="z-index: -1;" v-model="codeNum" ref="inputSelectBound"></el-input>
在 script 标签内
<script setup>
import { ref, onMounted, nextTick } from 'vue'
const inputSelectBound = ref(null)
onMounted(() => {
nextTick(() => {
inputSelectBound.value.focus()
})
})
</script>