主题
useTextDirection
元素文本的反应性dir。
🌐 Reactive dir of the element's text.
示例
用法
🌐 Usage
ts
import { useTextDirection } from '@vueuse/core'
const dir = useTextDirection() // Ref<'ltr' | 'rtl' | 'auto'>默认情况下,当对 html 标签应用 rtl 方向时,它会返回 rtl 方向,例如:
🌐 By default, it returns rtl direction when dir rtl is applied to the html tag, for example:
html
<!--ltr-->
<html>
...
</html>
<!--rtl-->
<html dir="rtl">
...
</html>选项
🌐 Options
ts
import { useTextDirection } from '@vueuse/core'
const mode = useTextDirection({
selector: 'body'
}) // Ref<'ltr' | 'rtl' | 'auto'>