Fix filter structure in fetchVndbQuotes and enhance screenshot validation in VndbPanel.vue

- Updated the filter format in fetchVndbQuotes to directly use vnId for improved clarity.
- Added a check in VndbPanel.vue to ensure the current game ID matches before processing screenshots, preventing unnecessary updates.
This commit is contained in:
AdingApkgg
2025-12-26 21:17:01 +08:00
parent fef9629b8f
commit a3bed57fbb
2 changed files with 6 additions and 1 deletions

View File

@@ -598,7 +598,7 @@ export async function fetchVndbQuotes(vnId: string): Promise<VndbQuote[]> {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
filters: ['vn', '=', ['id', '=', vnId]],
filters: ['vn', '=', vnId],
fields: 'id, quote, character{id, name, original}',
results: 10,
}),

View File

@@ -730,8 +730,13 @@ watch(() => searchStore.vndbInfo, async (newInfo) => {
// 检查缓存的截图是否已加载
if (newInfo?.screenshots && newInfo.screenshots.length > 0) {
const vnIdForScreenshots = newInfo.id
nextTick(() => {
requestAnimationFrame(() => {
// 检查是否仍是同一个游戏
if (currentVnId.value !== vnIdForScreenshots) {
return
}
const screenshotImgs = modalRef.value?.querySelectorAll('img[alt*="截图"]')
if (screenshotImgs) {
for (let i = 0; i < screenshotImgs.length; i++) {