修改复制链接等功能

This commit is contained in:
2025-08-06 22:36:01 +08:00
parent 3c359c6a19
commit cca2b53694

View File

@@ -5,36 +5,37 @@ const route = useRoute()
const toast = useToast()
const { copy, copied } = useClipboard()
const markdownLink = computed(() => `${window?.location?.origin}/raw${route.path}.md`)
const mdcLink = computed(() => `${window?.location?.origin}${decodeURIComponent(route.path)}`)
const markdownLink = computed(() => `${window?.location?.origin}/raw${decodeURIComponent(route.path)}.md`)
const items = [
{
label: 'Copy Markdown link',
label: '复制链接',
icon: 'lucide-link',
onSelect() {
copy(markdownLink.value)
copy(mdcLink.value)
toast.add({
title: 'Markdown link copied to clipboard',
title: '文档链接已复制到剪贴板',
icon: 'lucide-check-circle',
color: 'success'
})
}
},
{
label: 'View as Markdown',
label: '查看 Markdown',
icon: 'simple-icons:markdown',
target: '_blank',
to: markdownLink.value
},
{
label: 'Open in ChatGPT',
label: ' ChatGPT 中打开',
icon: 'simple-icons:openai',
target: '_blank',
to: `https://chatgpt.com/?hints=search&q=${encodeURIComponent(`Read ${markdownLink.value} so I can ask questions about it.`)}`
},
{
label: 'Open in Claude',
label: ' Claude 中打开',
icon: 'simple-icons:anthropic',
target: '_blank',
to: `https://claude.ai/new?q=${encodeURIComponent(`Read ${markdownLink.value} so I can ask questions about it.`)}`
@@ -45,14 +46,14 @@ const items = [
<template>
<UButtonGroup size="sm">
<UButton
label="Copy page"
label="复制链接"
:icon="copied ? 'lucide-copy-check' : 'lucide-copy'"
color="neutral"
variant="outline"
:ui="{
leadingIcon: [copied ? 'text-primary' : 'text-neutral', 'size-3.5']
}"
@click="copy(markdownLink)"
@click="copy(mdcLink)"
/>
<UDropdownMenu