mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
25 lines
574 B
JavaScript
25 lines
574 B
JavaScript
import { toRef, inject } from 'vue'
|
|
|
|
export function useSiteDisplayMode () {
|
|
return toRef(inject('SiteProvider'), 'displayMode')
|
|
}
|
|
|
|
export function useSiteTheme () {
|
|
return toRef(inject('SiteProvider'), 'theme')
|
|
}
|
|
|
|
export function useSiteLang () {
|
|
return toRef(inject('SiteProvider'), 'lang')
|
|
}
|
|
|
|
export const i18n = function (data) {
|
|
const configProvider = inject('NConfigProvider', null)
|
|
return {
|
|
locale: toRef(configProvider, 'mergedLanguage'),
|
|
t (key) {
|
|
const { mergedLanguage } = configProvider
|
|
return data[mergedLanguage][key]
|
|
}
|
|
}
|
|
}
|