Fix: reset current page

This commit is contained in:
Lazy 2024-01-08 22:53:57 +08:00
parent a97efa50af
commit 8b2e658340

View File

@ -74,9 +74,10 @@ const initNodes = async () => {
} }
}; };
const initInstancesData = async () => { const initInstancesData = async (resetPage?: boolean) => {
try { try {
selectedInstance.value = []; selectedInstance.value = [];
if (resetPage) operationForm.value.currentPage = 1;
if (!currentRemoteNode.value) { if (!currentRemoteNode.value) {
await initNodes(); await initNodes();
} }
@ -112,7 +113,7 @@ const handleChangeNode = async (item: NodeStatus) => {
try { try {
currentRemoteNode.value = item; currentRemoteNode.value = item;
selectedInstance.value = []; selectedInstance.value = [];
await initInstancesData(); await initInstancesData(true);
localStorage.setItem("pageSelectedRemote", JSON.stringify(item)); localStorage.setItem("pageSelectedRemote", JSON.stringify(item));
} catch (err: any) { } catch (err: any) {
console.error(err.message); console.error(err.message);
@ -262,7 +263,7 @@ const batchDeleteInstance = async (deleteFile: boolean) => {
message: t("TXT_CODE_c3c06801"), message: t("TXT_CODE_c3c06801"),
description: t("TXT_CODE_50075e02") description: t("TXT_CODE_50075e02")
}); });
await initInstancesData(); await initInstancesData(true);
} }
} catch (err: any) { } catch (err: any) {
console.error(err); console.error(err);
@ -406,7 +407,7 @@ onMounted(async () => {
v-model:pageSize="operationForm.pageSize" v-model:pageSize="operationForm.pageSize"
:total="instances.maxPage * operationForm.pageSize" :total="instances.maxPage * operationForm.pageSize"
show-size-changer show-size-changer
@change="initInstancesData" @change="initInstancesData()"
/> />
</template> </template>
</BetweenMenus> </BetweenMenus>