mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
add questionbox share card
This commit is contained in:
17
src/Utils.ts
17
src/Utils.ts
@@ -1,6 +1,8 @@
|
||||
import { useOsTheme } from "naive-ui"
|
||||
import { ThemeType } from "./api/api-models"
|
||||
import { useStorage } from "@vueuse/core"
|
||||
import { createDiscreteApi, useOsTheme } from 'naive-ui'
|
||||
import { ThemeType } from './api/api-models'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
|
||||
const { message } = createDiscreteApi(['message'])
|
||||
|
||||
const osThemeRef = useOsTheme() //获取当前系统主题
|
||||
export function NavigateToNewTab(url: string) {
|
||||
@@ -8,7 +10,14 @@ export function NavigateToNewTab(url: string) {
|
||||
}
|
||||
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
|
||||
}
|
||||
export function copyToClipboard(text: string) {
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(text)
|
||||
message.success('已复制到剪切板')
|
||||
} else {
|
||||
message.warning('当前环境不支持自动复制, 请手动选择并复制')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user