Skip to content

useTextSelection

基于 Window.getSelection 反应式跟踪用户文本选择。

¥Reactively track user text selection based on Window.getSelection.

示例

You can select any text on the page.

Selected Text:No selected

Selected rects:

[]

用法

¥Usage

vue
<script setup lang="ts">
import { 
useTextSelection
} from '@vueuse/core'
const
state
=
useTextSelection
()
</script> <template> <
p
>{{
state
.
text
}}</
p
>
</template>