diff --git a/packages-user/client-modules/src/render/ui/save.tsx b/packages-user/client-modules/src/render/ui/save.tsx index 56f9de0..2067e5b 100644 --- a/packages-user/client-modules/src/render/ui/save.tsx +++ b/packages-user/client-modules/src/render/ui/save.tsx @@ -183,6 +183,8 @@ export const Save = defineComponent( return [right, height.value - 13, void 0, void 0, 1, 1]; }); + //#region 数据信息 + /** * 获取存档在当前页的序号,范围为 0 到 pageCap-1。 */ @@ -204,10 +206,9 @@ export const Save = defineComponent( const index = getIndex(i, page); promises.push(getSave(index + 1)); } - const before = now.value; + const before = page; const data = await Promise.all(promises); - if (before !== now.value) return; - + if (now.value !== before) return; data.forEach((v, i) => { if (v) { saveData[i] = v; @@ -217,6 +218,17 @@ export const Save = defineComponent( }); }; + onMounted(() => { + const startIndex = getPosIndex(core.saves.saveIndex); + selected.value = startIndex - 1; + pageRef.value?.changePage( + Math.floor(core.saves.saveIndex / (grid.value.count - 1)) + ); + updateDataList(now.value); + }); + + //#region 逻辑操作 + const exist = (index: number) => { return saveData[index] !== null; }; @@ -225,15 +237,6 @@ export const Save = defineComponent( saveData[index] = null; }; - onMounted(() => { - const startIndex = getPosIndex(core.saves.saveIndex); - selected.value = startIndex; - pageRef.value?.changePage( - Math.floor(core.saves.saveIndex / (grid.value.count - 1)) - ); - updateDataList(now.value); - }); - const emitSave = async (index: number) => { const posIndex = getPosIndex(index); if (inDelete.value) { @@ -258,15 +261,6 @@ export const Save = defineComponent( } }; - const wheel = (ev: IWheelEvent) => { - const delta = Math.sign(ev.wheelY); - if (ev.ctrlKey) { - pageRef.value?.movePage(delta * 10); - } else { - pageRef.value?.movePage(delta); - } - }; - const toggleDelete = () => { inDelete.value = !inDelete.value; }; @@ -374,6 +368,16 @@ export const Save = defineComponent( { type: 'down-repeat' } ); + //#region 事件监听 + const wheel = (ev: IWheelEvent) => { + const delta = Math.sign(ev.wheelY); + if (ev.ctrlKey) { + pageRef.value?.movePage(delta * 10); + } else { + pageRef.value?.movePage(delta); + } + }; + return () => ( ( const index = i === 0 ? 0 : rawIndex; return (