Skip to content

usePreferredLanguages

反应式 导航语言。它为网络开发者提供有关用户首选语言的信息。例如,这对于根据用户的首选语言调整用户界面的语言以提供更好的体验可能很有用。

¥Reactive Navigator Languages. It provides web developers with information about the user's preferred languages. For example, this may be useful to adjust the language of the user interface based on the user's preferred languages in order to provide better experience.

示例

Preferred Languages:
en

用法

¥Usage

js
import { usePreferredLanguages } from '@vueuse/core'

const languages = usePreferredLanguages()

组件用法

¥Component Usage

vue
<template>
  <UsePreferredLanguages v-slot="{ languages }">
    Preferred Languages: {{ languages }}
  </UsePreferredLanguages>
</template>

类型声明

typescript
/**
 * Reactive Navigator Languages.
 *
 * @see https://vueuse.org/usePreferredLanguages
 * @param options
 */
export declare function usePreferredLanguages(
  options?: ConfigurableWindow,
): Ref<readonly string[]>

源代码

源代码示例文档

变更日志

No recent changes

VueUse 中文网 - 粤ICP备13048890号