处理 t-link

close #156
This commit is contained in:
BTMuli
2026-01-16 23:27:08 +08:00
parent a2f0a532a8
commit 422f6231c8
9 changed files with 709 additions and 7 deletions

View File

@@ -0,0 +1,33 @@
<template>
<span
style="cursor: pointer"
@click="showOverlay()"
v-html="parseHtmlText(decodeURIComponent(props.content))"
/>
</template>
<script lang="ts" setup>
import showHyperLink from "@comp/func/hyperlink.js";
import showSnackbar from "@comp/func/snackbar.js";
import { parseHtmlText } from "@utils/toolFunc.js";
import { defineProps, onMounted, shallowRef } from "vue";
import { WikiHyperLinkData } from "@/data/index.js";
type TLinkProps = { link: string; content: string };
const props = defineProps<TLinkProps>();
const info = shallowRef<TGApp.App.HyperLink.HyperLinkItem>();
onMounted(async () => {
const find = WikiHyperLinkData.find((i) => i.id.toString() === props.link.slice(1));
if (find) info.value = find;
});
async function showOverlay() {
if (!info.value) {
showSnackbar.warn("未获取到对应HyperLink数据");
return;
}
await showHyperLink({ ...info.value, id: props.link });
}
</script>