mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-05 07:15:06 +08:00
🚸 右键复制链接
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
v-if="mode == 'link'"
|
||||
class="tp-text-link"
|
||||
@click="toLink()"
|
||||
@contextmenu="copyLink()"
|
||||
:title="props.data.attributes?.link"
|
||||
:style="getTextStyle()"
|
||||
>
|
||||
@@ -110,6 +111,19 @@ async function toLink(): Promise<void> {
|
||||
await openUrl(res);
|
||||
}
|
||||
|
||||
// 复制链接
|
||||
async function copyLink(): Promise<void> {
|
||||
if (!props.data.attributes) return;
|
||||
if (!props.data.attributes.link) return;
|
||||
const link = props.data.attributes.link;
|
||||
try {
|
||||
await navigator.clipboard.writeText(link);
|
||||
showSnackbar.success("链接已复制到剪贴板");
|
||||
} catch (e) {
|
||||
showSnackbar.error(`复制链接失败: ${e}`, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
// 解析表情链接
|
||||
function getEmojiUrl(): string {
|
||||
if (localEmojis.value === null || !JSON.parse(localEmojis.value)[getEmojiName()]) {
|
||||
|
||||
Reference in New Issue
Block a user