fix(plan):优化计划列表映射和保存逻辑
移除 planList 映射中未使用的 index 参数,简化代码逻辑。 调整 watch 回调执行时机,使用 flush: 'post' 确保在 DOM 更新后执行,并移除不必要的 nextTick 等待,直接调用防抖保存函数。
This commit is contained in:
@@ -284,7 +284,7 @@ const initPlans = async () => {
|
||||
try {
|
||||
const response = await getPlans()
|
||||
if (response.index && response.index.length > 0) {
|
||||
planList.value = response.index.map((item: any, index: number) => {
|
||||
planList.value = response.index.map((item: any) => {
|
||||
const planId = item.uid
|
||||
const planData = response.data[planId]
|
||||
const planType = planData?.Info?.Type || 'MaaPlan'
|
||||
@@ -343,10 +343,11 @@ const getPlanTypeLabel = (planType: string) =>
|
||||
|
||||
watch(
|
||||
() => [currentPlanName.value, currentMode.value],
|
||||
async () => {
|
||||
await nextTick()
|
||||
await debouncedSave()
|
||||
}
|
||||
() => {
|
||||
// await nextTick()
|
||||
debouncedSave() // 直接调用即可,无需等待
|
||||
},
|
||||
{ flush: 'post' }
|
||||
)
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user