refactor: use head script instead of cookie
This commit is contained in:
parent
dcf0dd7018
commit
55aff4778b
8 changed files with 62 additions and 45 deletions
10
plugins/setup-font-size.client.ts
Normal file
10
plugins/setup-font-size.client.ts
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { fontSizeMap } from '~/constants/options'
|
||||
import { DEFAULT_FONT_SIZE } from '~/constants'
|
||||
|
||||
export default defineNuxtPlugin(() => {
|
||||
const userSettings = useUserSettings()
|
||||
const html = document.querySelector('html')!
|
||||
watchEffect(() => {
|
||||
html.style.setProperty('--font-size', fontSizeMap[userSettings.value.fontSize || DEFAULT_FONT_SIZE])
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue