Files
vtsuru.live/src/Utils.ts
2023-10-16 11:27:37 +08:00

15 lines
494 B
TypeScript

import { useOsTheme } from "naive-ui"
import { ThemeType } from "./api/api-models"
import { useStorage } from "@vueuse/core"
const osThemeRef = useOsTheme() //获取当前系统主题
export function NavigateToNewTab(url: string) {
window.open(url, '_blank')
}
const themeType = useStorage('Settings.Theme', ThemeType.Auto)
export function isDarkMode(): boolean {
if (themeType.value == ThemeType.Auto) return osThemeRef.value === 'dark'
else return themeType.value == ThemeType.Dark
}