Skip to content

useTextSelection

类别
导出大小
755 B
最近修改
2 days ago

基于 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>