From dc1ccfe69938a7285d188143bc7a9e62495b2c23 Mon Sep 17 00:00:00 2001 From: joylink_cuiweidong <364937672@qq.com> Date: Mon, 23 Nov 2020 13:41:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E7=BB=98=E5=88=B6=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jmapNew/utils/parser.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/jmapNew/utils/parser.js b/src/jmapNew/utils/parser.js index 264f83bd2..2733cdba6 100644 --- a/src/jmapNew/utils/parser.js +++ b/src/jmapNew/utils/parser.js @@ -259,16 +259,16 @@ export function updateForList(model, state, lstName) { const list = state.map[lstName]; if (list && list instanceof Array) { const i = list.findIndex(elem => elem.code == model.code ); - if (list[i] < 0) { + if (i < 0) { list.push(deepClone(model)); // 新增 } else { - if (model._dispose) { - list.splice(i, 1); - } else { - list.splice(i, 1, deepClone(model)); - } - } - state.map[lstName] = [...list]; + if (model._dispose) { + list.splice(i, 1); + } else { + list.splice(i, 1, deepClone(model)); + } + } + state.map[lstName] = [...list]; } else { state.map[lstName] = [model]; }