🐛 修复特定条件下的渲染异常

This commit is contained in:
BTMuli
2026-02-08 18:29:48 +08:00
parent b7d875b0d0
commit 8dd8635c04
5 changed files with 24 additions and 21 deletions

View File

@@ -1,8 +1,8 @@
<template>
<component
:is="getTpName(tp)"
v-for="(tp, index) in getParsedData(props.data)"
:key="index"
:is="getTpName(tp)"
:data="tp"
/>
</template>
@@ -44,6 +44,7 @@ function getParsedData(data: SctPostDataArr): SctPostDataArr {
continue;
}
if (tpName !== TpText) {
if (child.length > 0) res.push(...child);
cur = tp;
child = [];
res.push(cur);

View File

@@ -70,18 +70,14 @@
</div>
</v-menu>
</div>
<VpReplyDebug v-if="devMode" v-model="showDebug" />
</template>
<script lang="ts" setup>
import showSnackbar from "@comp/func/snackbar.js";
import postReq from "@req/postReq.js";
import useAppStore from "@store/app.js";
import { emit } from "@tauri-apps/api/event";
import TGLogger from "@utils/TGLogger.js";
import { storeToRefs } from "pinia";
import { computed, ref, shallowRef, watch } from "vue";
import VpReplyDebug from "./vp-reply-debug.vue";
import VpReplyItem from "./vp-reply-item.vue";
/**
@@ -116,8 +112,6 @@ type SelectItem = {
value: ReplyOrderType;
};
const { devMode } = storeToRefs(useAppStore());
const props = defineProps<TprMainProps>();
const orderList: Array<SelectItem> = [
@@ -131,7 +125,6 @@ const lastId = ref<string>();
const isLast = ref<boolean>(false);
const loading = ref<boolean>(false);
const showOverlay = ref<boolean>(false);
const showDebug = ref<boolean>(false);
const onlyLz = ref<boolean>(false);
const orderType = ref<ReplyOrderType>(ReplyOrderType.HOT);
const reply = shallowRef<Array<TGApp.BBS.Reply.ReplyFull>>([]);
@@ -212,11 +205,6 @@ async function loadReply(): Promise<void> {
}
async function handleDebug(): Promise<void> {
if (devMode.value) {
showDebug.value = true;
return;
}
if (showDebug.value) showDebug.value = false;
await reloadReply();
}
</script>

View File

@@ -4,7 +4,7 @@
<div class="tpr-debug-title">
<span>文件</span>
<span :title="filePath">{{ filePath }}</span>
<v-btn @click="selectFile" color="primary">选择文件</v-btn>
<v-btn size="small" @click="selectFile" color="primary">选择文件</v-btn>
</div>
<div class="tpr-debug-reply">
<TprReply mode="main" :modelValue="replyData" v-if="replyData !== null" pinId="0" />
@@ -56,28 +56,32 @@ async function selectFile(): Promise<void> {
position: relative;
display: flex;
width: 800px;
max-height: 600px;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 5px;
border-radius: 5px;
padding: 8px;
border-radius: 4px;
background: var(--box-bg-1);
box-shadow: 0 0 5px var(--common-shadow-1);
row-gap: 8px;
}
.tpr-debug-title {
position: relative;
display: flex;
overflow: hidden;
width: 100%;
flex-shrink: 0;
align-items: center;
justify-content: flex-start;
padding: 5px;
padding: 4px;
border-bottom: 1px solid var(--box-bg-2);
font-family: var(--font-title);
text-overflow: ellipsis;
white-space: nowrap;
:nth-child(2) {
span:nth-child(2) {
overflow: hidden;
max-width: 600px;
margin-right: auto;

View File

@@ -14,14 +14,24 @@
</div>
</div>
<div class="btn-list">
<v-btn class="test-btn" @click="testReply()">回复测试</v-btn>
<v-btn class="test-btn" @click="test()">测试</v-btn>
</div>
</div>
<VpReplyDebug v-model="showReply" />
</template>
<script lang="ts" setup>
import VpReplyDebug from "@comp/viewPost/vp-reply-debug.vue";
import { invoke } from "@tauri-apps/api/core";
import { appConfigDir, resourceDir } from "@tauri-apps/api/path";
import { copyFile, exists } from "@tauri-apps/plugin-fs";
import { ref } from "vue";
const showReply = ref<boolean>(false);
function testReply(): void {
showReply.value = true;
}
async function test() {
await invoke("is_msix");

View File

@@ -1,6 +1,6 @@
/**
* 用户祈愿模块
* @since Beta v0.9.5
* @since Beta v0.9.6
*/
import showLoading from "@comp/func/loading.js";
@@ -11,7 +11,7 @@ import TGSqlite from "../index.js";
/**
* 导入物品
* @since Beta v0.9.5
* @since Beta v0.9.6
* @param uid - UID
* @param item - UIGF数据
* @returns Promise<void>
@@ -23,7 +23,7 @@ async function insertGachaItem(uid: string, item: TGApp.Plugins.UIGF.GachaItem):
`INSERT INTO GachaRecords(uid, gachaType, itemId, count, time,
name, type, rank, id, uigfType, updated)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
ON CONFLICT DO UPDATE
ON CONFLICT(id) DO UPDATE
SET uid = $1,
gachaType = $2,
itemId = $3,