fix: 修正移除站点逻辑,确保从选中项中正确移除已删除的站点
Some checks failed
/ build-and-deploy-to-vercel (push) Successful in 2m34s
/ lint-build-and-check (push) Successful in 4m26s
/ playwright (push) Failing after 11m51s
/ surge (push) Successful in 2m32s

This commit is contained in:
严浩
2025-04-01 14:32:32 +08:00
parent 302151eea8
commit 5c92482122

View File

@ -40,14 +40,21 @@ const addRandomStation = () => {
// 移除最后一个站点
const removeLastStation = () => {
if (selectedIds.value.length > 0) {
selectedIds.value.pop(); // 移除选中项
if (groundStations.value.length > 0) {
const removedStation = groundStations.value.pop();
if (removedStation) {
consola.info('移除站点:', removedStation);
// 同时从选中项中移除
selectedIds.value = selectedIds.value.filter((id) => id !== removedStation.id);
}
}
};
// 清空所有选中项
const clearAllStations = () => {
selectedIds.value = []; // 同时清空选中项
groundStations.value = [];
selectedIds.value = []; // 清空选中项
consola.info('清空所有站点');
};
</script>