Skip to content

onStartTyping

Category
Export Size
704 B
Last Changed
15 minutes ago

用户在不可编辑的元素上开始输入时触发。

Demo

输入任何内容

用法

vue
<input ref="input" type="text" placeholder="Start typing to focus" />
ts
import { onStartTyping } from '@vueuse/core'

export default {
  setup() {
    const input = ref(null)

    onStartTyping(() => {
      if (!input.value.active)
        input.value.focus()
    })

    return {
      input,
    }
  },
}

类型声明

typescript
/**
 * 用户在不可编辑的元素上开始输入时触发回调。
 *
 * @see https://vueuse.org/onStartTyping
 * @param callback
 * @param options
 */
export declare function onStartTyping(
  callback: (event: KeyboardEvent) => void,
  options?: ConfigurableDocument,
): void

Source

SourceDemoDocs

贡献者

Anthony Fu
丶远方
Anthony Fu
meenie-net
Alex Kozack
Nurettin Kaya
Antério Vieira
Seifeldin Mahjoub

变更日志

v10.7.0 on 12/5/2023
fccf2 - feat: upgrade deps (#3614)
v10.0.0-beta.3 on 4/12/2023
e9ab3 - fix: fix char ascii (#2932)

Released under the MIT License.