fix: 修正移除站点逻辑,确保从选中项中正确移除已删除的站点
This commit is contained in:
@ -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>
|
||||
|
||||
|
Reference in New Issue
Block a user