fix: rework setup to improve SSR compatibility
This commit is contained in:
parent
fd7d30a38a
commit
d8d163dbd0
22 changed files with 137 additions and 73 deletions
14
composables/injections.ts
Normal file
14
composables/injections.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { InjectionKeyColorMode, InjectionKeyFontSize } from '~/constants/symbols'
|
||||
|
||||
export function useFontSizeRef() {
|
||||
return inject(InjectionKeyFontSize)!
|
||||
}
|
||||
|
||||
export function useColorModeRef() {
|
||||
return inject(InjectionKeyColorMode)!
|
||||
}
|
||||
|
||||
export function toggleColorMode() {
|
||||
const colorMode = useColorModeRef()
|
||||
colorMode.value = colorMode.value === 'light' ? 'dark' : 'light'
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue