From c51978a24a5f61a8a4ef7431300f5596bde43e0b Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期五, 19 八月 2022 13:58:05 +0800 Subject: [PATCH] # --- pages/basics/pakin.vue | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) diff --git a/pages/basics/pakin.vue b/pages/basics/pakin.vue index 92d886e..3544f34 100644 --- a/pages/basics/pakin.vue +++ b/pages/basics/pakin.vue @@ -301,7 +301,8 @@ events: { // 涓烘寚瀹氫簨浠舵坊鍔犱竴涓洃鍚櫒锛岃幏鍙栬鎵撳紑椤甸潰浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹� matList: function(data) { - that.matList.push(data.data) + that.checkMat(data.data) + // that.matList.push(data.data) }, }, success: function(res) { @@ -315,7 +316,25 @@ }); }, - + // 娣诲姞鍟嗗搧 + addMat(mat) { + this.matList.unshift(mat) + }, + checkMat(mat) { + var len = this.matList.length + var add = true + for (var i = 0; i < len; i++) { + console.log(mat.matnr === this.matList[i].matnr); + if (mat.matnr === this.matList[i].matnr) { + this.matList[i].anfme += mat.anfme + this.$forceUpdate() // 寮哄埗鍒锋柊 + add = false + } + } + if (add) { + this.matList.unshift(mat) + } + }, change(e) { console.log('褰撳墠妯″紡锛�' + e.type + ',鐘舵�侊細' + e.show); }, -- Gitblit v1.9.1