Type anything
onStartTyping
Fires when users start typing on non-editable elements.
Usage
<input ref="input" type="text" placeholder="Start typing to focus" />
import { onStartTyping } from '@vueuse/core'
export default {
setup() {
const input = ref(null)
onStartTyping(() => {
if (!input.value.active)
input.value.focus()
})
return {
input,
}
},
}
Type Declarations
/**
* Fires when users start typing on non-editable elements.
*
* @see {@link /onStartTyping}
* @param callback
* @param options
*/
export declare function onStartTyping(
callback: (event: KeyboardEvent) => void,
{ document }?: ConfigurableDocument
): void