feat: 多语言支持 https://github.com/vastsa/FileCodeBox/issues/310 https://github.com/vastsa/FileCodeBox/issues/299
This commit is contained in:
@@ -3,17 +3,17 @@ import { inject } from 'vue'
|
||||
import { SunIcon, MoonIcon } from 'lucide-vue-next'
|
||||
|
||||
const isDarkMode = inject('isDarkMode') as { value: boolean }
|
||||
const setColorMode = inject('setColorMode') as (isDark: boolean) => void
|
||||
const toggleTheme = inject('toggleTheme') as () => void
|
||||
|
||||
const toggleColorMode = () => {
|
||||
setColorMode(!isDarkMode.value)
|
||||
toggleTheme()
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
@click="toggleColorMode"
|
||||
class="fixed top-4 right-4 z-10 p-2 rounded-full transition-all duration-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transform hover:rotate-180"
|
||||
class="p-2 rounded-full transition-all duration-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transform hover:rotate-180"
|
||||
:class="isDarkMode ? 'bg-gray-800 text-yellow-300' : 'bg-white text-gray-800'"
|
||||
>
|
||||
<SunIcon v-if="!isDarkMode" class="w-6 h-6" />
|
||||
|
||||
Reference in New Issue
Block a user