Open c11ee opened 4 months ago
<script setup lang="ts"> import { ref } from 'vue' const state = ref(false) type FnType = (el: HTMLInputElement, { value }: { value: boolean }) => void const handleFocus: FnType = (el, { value }) => el[value ? 'focus' : 'blur']() const vFocus = { mounted: handleFocus, updated: handleFocus } setInterval(() => { state.value = !state.value }, 2000) </script> <template> <input v-focus="state" type="text" /> </template>