feat(theme): add lang switch to update html lang attr (#867)
This commit is contained in:
parent
916e9141d9
commit
fd1dd7c695
@ -90,6 +90,7 @@ export function registerWatchers() {
|
||||
}, { passive: true })
|
||||
}
|
||||
|
||||
const { lang } = useData()
|
||||
const route = useRoute()
|
||||
const { disableSidebar, toggleSidebarCollapse } = useSidebarControl()
|
||||
watch(() => route.path, () => {
|
||||
@ -97,5 +98,11 @@ export function registerWatchers() {
|
||||
toggleSidebarCollapse(false)
|
||||
})
|
||||
|
||||
if (inBrowser) {
|
||||
watch(lang, (newLang) => {
|
||||
document.documentElement.lang = newLang
|
||||
}, { immediate: true })
|
||||
}
|
||||
|
||||
useCloseSidebarOnEscape()
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user