Skip to content

Commit

Permalink
🐛 修复特定情况下的渲染错误,调整格式
Browse files Browse the repository at this point in the history
  • Loading branch information
BTMuli committed Sep 4, 2024
1 parent 67f89dd commit f2ec183
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/post/tp-parser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function getParsedData(data: TGApp.Plugins.Mys.SctPost.Base[]): TGApp.Plugins.My
child = [];
}
}
if (check !== parsedText.length && check !== 0) {
if (check < parsedText.length && check !== 0) {
res.push(...child);
child = [];
}
Expand Down
16 changes: 9 additions & 7 deletions src/components/postReply/tpr-reply.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</div>
<div class="tpr-info">
<div class="tpri-left">
<span>{{ getTime() }}</span>
<span :title="getFullTime()">{{ getTime() }}</span>
<span>{{ props.modelValue.user.ip_region }}</span>
</div>
<div class="tpri-right">
Expand Down Expand Up @@ -128,21 +128,23 @@ watch(
async (value) => {
if (value) {
await event.emit("openReplySub", props.modelValue.reply.reply_id);
console.error("emit openReplySub");
}
},
);
async function listenSub(): Promise<UnlistenFn> {
return await event.listen("openReplySub", async (e: Event<string>) => {
if (e.payload !== props.modelValue.reply.reply_id) {
if (showSub.value) {
showSub.value = false;
}
if (showSub.value) showSub.value = false;
}
});
}
function getFullTime(): string {
const time = new Date(props.modelValue.reply.created_at * 1000);
return time.toLocaleString().replace(/\//g, "-");
}
function getTime(): string {
const time = new Date(props.modelValue.reply.created_at * 1000);
const now = new Date();
Expand All @@ -152,10 +154,10 @@ function getTime(): string {
}
// 如果是今年,显示 MM-dd
if (time.getFullYear() === now.getFullYear()) {
return time.toLocaleDateString().slice(5);
return time.toLocaleDateString().slice(5).replace(/\//g, "-");
}
// 否则显示 yyyy-MM-dd
return time.toLocaleDateString();
return time.toLocaleDateString().replace(/\//g, "-");
}
async function showReply(): Promise<void> {
Expand Down

0 comments on commit f2ec183

Please sign in to comment.