useActiveElement
useActiveElement
リアクティブな document.activeElement
使用法
import { useActiveElement } from '@vueuse/core'
import { watch } from 'vue'
const activeElement = useActiveElement()
watch(activeElement, (el) => {
console.log('focus changed to', el)
})
コンポーネントの使用法
<template>
<UseActiveElement v-slot="{ element }">
アクティブな要素は {{ element?.dataset.id }} です
</UseActiveElement>
</template>
© 2019–PRESENT Anthony Fu https://github.com/antfu
※このページは Nuxt.js 公式ドキュメントの翻訳ページです。
公式ドキュメントの該当ページはこちら:
#