mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-08 00:24:06 +08:00
♻️ 公告解析重构完成
This commit is contained in:
@@ -47,7 +47,6 @@ const props = defineProps<TpTextProps>();
|
||||
const mode = ref<string>("text");
|
||||
const localEmojis = ref(localStorage.getItem("emojis"));
|
||||
const emojis = ref<TpText[]>([]);
|
||||
const router = useRouter();
|
||||
|
||||
console.log("tpText", JSON.stringify(props.data.insert), toRaw(props.data)?.attributes);
|
||||
|
||||
@@ -100,7 +99,7 @@ async function toLink() {
|
||||
const link = props.data.attributes.link;
|
||||
const isPost = await parsePost(link);
|
||||
if (isPost !== false) {
|
||||
await router.push({
|
||||
await useRouter().push({
|
||||
name: "帖子详情",
|
||||
params: {
|
||||
post_id: isPost,
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import { StyleValue } from "vue";
|
||||
import type { Component } from "vue";
|
||||
|
||||
import TpImage from "./tp-image.vue";
|
||||
import TpMention, { type TpMention as TpMentionType } from "./tp-mention.vue";
|
||||
import TpText, { type TpText as TpTextType } from "./tp-text.vue";
|
||||
|
||||
@@ -29,6 +30,9 @@ function getComp(text: TpTextType | TpMentionType): Component {
|
||||
if (typeof text.insert === "string") {
|
||||
return TpText;
|
||||
}
|
||||
if ("image" in text.insert) {
|
||||
return TpImage;
|
||||
}
|
||||
return TpMention;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user