add rank.
This commit is contained in:
@@ -1,30 +1,30 @@
|
||||
<script setup lang="ts">
|
||||
import { DocumentCopy, Select } from "@element-plus/icons-vue"
|
||||
import copy from "copy-text-to-clipboard"
|
||||
|
||||
defineProps<{ value: string }>()
|
||||
const [copied, toggle] = useToggle()
|
||||
const { start } = useTimeoutFn(() => toggle(false), 1000, { immediate: false })
|
||||
|
||||
function handleClick(value: string) {
|
||||
copy(value)
|
||||
toggle(true)
|
||||
start()
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-icon class="icon" @click="handleClick(value)">
|
||||
<component :is="copied ? Select : DocumentCopy"></component>
|
||||
</n-icon>
|
||||
</template>
|
||||
{{ copied ? "已复制" : "复制" }}
|
||||
</n-tooltip>
|
||||
</template>
|
||||
<style scoped>
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
</style>
|
||||
<script setup lang="ts">
|
||||
import { DocumentCopy, Select } from "@element-plus/icons-vue"
|
||||
import copy from "copy-text-to-clipboard"
|
||||
|
||||
defineProps<{ value: string }>()
|
||||
const [copied, toggle] = useToggle()
|
||||
const { start } = useTimeoutFn(() => toggle(false), 1000, { immediate: false })
|
||||
|
||||
function handleClick(value: string) {
|
||||
copy(value)
|
||||
toggle(true)
|
||||
start()
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<n-tooltip trigger="hover">
|
||||
<template #trigger>
|
||||
<n-icon class="icon" @click="handleClick(value)">
|
||||
<component :is="copied ? Select : DocumentCopy"></component>
|
||||
</n-icon>
|
||||
</template>
|
||||
{{ copied ? "已复制" : "复制" }}
|
||||
</n-tooltip>
|
||||
</template>
|
||||
<style scoped>
|
||||
.icon {
|
||||
cursor: pointer;
|
||||
transform: translateY(2px);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
Title,
|
||||
Colors,
|
||||
Tooltip,
|
||||
Legend,
|
||||
BarElement,
|
||||
ArcElement,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
} from "chart.js"
|
||||
|
||||
const [isLoaded] = useToggle()
|
||||
|
||||
export function loadChart() {
|
||||
if (isLoaded.value) return
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
ArcElement,
|
||||
Colors,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend
|
||||
)
|
||||
isLoaded.value = true
|
||||
}
|
||||
import {
|
||||
Chart as ChartJS,
|
||||
Title,
|
||||
Colors,
|
||||
Tooltip,
|
||||
Legend,
|
||||
BarElement,
|
||||
ArcElement,
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
} from "chart.js"
|
||||
|
||||
const [isLoaded] = useToggle()
|
||||
|
||||
export function loadChart() {
|
||||
if (isLoaded.value) return
|
||||
ChartJS.register(
|
||||
CategoryScale,
|
||||
LinearScale,
|
||||
BarElement,
|
||||
ArcElement,
|
||||
Colors,
|
||||
Title,
|
||||
Tooltip,
|
||||
Legend
|
||||
)
|
||||
isLoaded.value = true
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const code = ref("")
|
||||
export const code = ref("")
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import loader, { Monaco } from "@monaco-editor/loader"
|
||||
|
||||
export const monaco = ref<Monaco>()
|
||||
|
||||
export async function init() {
|
||||
loader.config({
|
||||
paths: { vs: "https://cdn.staticfile.org/monaco-editor/0.34.1/min/vs" },
|
||||
"vs/nls": { availableLanguages: { "*": "zh-cn" } },
|
||||
})
|
||||
|
||||
const [m, light, dark] = await Promise.all([
|
||||
loader.init(),
|
||||
fetch("/light.json").then((t) => t.json()),
|
||||
fetch("/dark.json").then((t) => t.json()),
|
||||
])
|
||||
monaco.value = m
|
||||
monaco.value.editor.defineTheme("light", light)
|
||||
monaco.value.editor.defineTheme("dark", dark)
|
||||
}
|
||||
import loader, { Monaco } from "@monaco-editor/loader"
|
||||
|
||||
export const monaco = ref<Monaco>()
|
||||
|
||||
export async function init() {
|
||||
loader.config({
|
||||
paths: { vs: "https://cdn.staticfile.org/monaco-editor/0.34.1/min/vs" },
|
||||
"vs/nls": { availableLanguages: { "*": "zh-cn" } },
|
||||
})
|
||||
|
||||
const [m, light, dark] = await Promise.all([
|
||||
loader.init(),
|
||||
fetch("/light.json").then((t) => t.json()),
|
||||
fetch("/dark.json").then((t) => t.json()),
|
||||
])
|
||||
monaco.value = m
|
||||
monaco.value.editor.defineTheme("light", light)
|
||||
monaco.value.editor.defineTheme("dark", dark)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user