fix(04): work name => name being use (delete), re select

This commit is contained in:
puriphatt 2024-09-20 11:45:34 +07:00
parent 1dd7873fce
commit b53ec8e91c
2 changed files with 15 additions and 4 deletions

View file

@ -66,8 +66,9 @@ watch(
const oldList = o.map((v: { name: string }) => v.name);
const index = oldList.indexOf(workName.value);
if (list[index] !== oldList[index]) {
workName.value = list[index];
if (list[index] !== oldList[index] && !list.includes(workName.value)) {
if (list.length - 1 === index - 1) workName.value = list[index - 1];
else workName.value = list[index];
}
},
);