add questionbox share card

This commit is contained in:
2023-10-25 22:14:22 +08:00
parent 308fc47322
commit ca1a005b9c
6 changed files with 516 additions and 295 deletions

View File

@@ -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('当前环境不支持自动复制, 请手动选择并复制')
}
}