🐛 修复特定情况下的渲染错误,调整格式

This commit is contained in:
目棃
2024-09-04 23:08:22 +08:00
parent 67f89dd998
commit f2ec18314b
2 changed files with 10 additions and 8 deletions

View File

@@ -70,7 +70,7 @@ function getParsedData(data: TGApp.Plugins.Mys.SctPost.Base[]): TGApp.Plugins.My
child = []; child = [];
} }
} }
if (check !== parsedText.length && check !== 0) { if (check < parsedText.length && check !== 0) {
res.push(...child); res.push(...child);
child = []; child = [];
} }

View File

@@ -30,7 +30,7 @@
</div> </div>
<div class="tpr-info"> <div class="tpr-info">
<div class="tpri-left"> <div class="tpri-left">
<span>{{ getTime() }}</span> <span :title="getFullTime()">{{ getTime() }}</span>
<span>{{ props.modelValue.user.ip_region }}</span> <span>{{ props.modelValue.user.ip_region }}</span>
</div> </div>
<div class="tpri-right"> <div class="tpri-right">
@@ -128,7 +128,6 @@ watch(
async (value) => { async (value) => {
if (value) { if (value) {
await event.emit("openReplySub", props.modelValue.reply.reply_id); await event.emit("openReplySub", props.modelValue.reply.reply_id);
console.error("emit openReplySub");
} }
}, },
); );
@@ -136,13 +135,16 @@ watch(
async function listenSub(): Promise<UnlistenFn> { async function listenSub(): Promise<UnlistenFn> {
return await event.listen("openReplySub", async (e: Event<string>) => { return await event.listen("openReplySub", async (e: Event<string>) => {
if (e.payload !== props.modelValue.reply.reply_id) { if (e.payload !== props.modelValue.reply.reply_id) {
if (showSub.value) { if (showSub.value) showSub.value = false;
showSub.value = false;
}
} }
}); });
} }
function getFullTime(): string {
const time = new Date(props.modelValue.reply.created_at * 1000);
return time.toLocaleString().replace(/\//g, "-");
}
function getTime(): string { function getTime(): string {
const time = new Date(props.modelValue.reply.created_at * 1000); const time = new Date(props.modelValue.reply.created_at * 1000);
const now = new Date(); const now = new Date();
@@ -152,10 +154,10 @@ function getTime(): string {
} }
// 如果是今年,显示 MM-dd // 如果是今年,显示 MM-dd
if (time.getFullYear() === now.getFullYear()) { if (time.getFullYear() === now.getFullYear()) {
return time.toLocaleDateString().slice(5); return time.toLocaleDateString().slice(5).replace(/\//g, "-");
} }
// 否则显示 yyyy-MM-dd // 否则显示 yyyy-MM-dd
return time.toLocaleDateString(); return time.toLocaleDateString().replace(/\//g, "-");
} }
async function showReply(): Promise<void> { async function showReply(): Promise<void> {