<template>
<input
type="text"
ref="input"
@keyup.ctrl.f="forward"
/>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
setup(){
let input = ref(null)
function forward(){
let selectionStart= input!.value!.selectionStart
input.setSelectionRange(selectionStart-1,selectionStart-1)
// console.log(input);
// console.log('forward');
}
return {
input,forward
}
});
</script>
ref 中dom的类型怎么支持
【题主编辑】另刚看 issue 有
Can't create a ref with a possibly null type