useTextSelection
useTextSelection
Window.getSelection に基づいて、ユーザーのテキスト選択をリアクティブに追跡します。
使用法
<script setup lang="ts">
import { useTextSelection } from '@vueuse/core'
const state = useTextSelection()
</script>
<template>
<p>{{ state.text }}</p>
</template>
© 2019–PRESENT Anthony Fu https://github.com/antfu
※このページは Nuxt.js 公式ドキュメントの翻訳ページです。
公式ドキュメントの該当ページはこちら:
#