From 2937f3c1742df1a0c3977176972e96d9e5e34759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=85=86=E7=90=A6?= <1361001127@qq.com> Date: Tue, 13 Aug 2024 13:09:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BD=BF=E7=94=A8id=E6=9D=A5=E5=AF=B9?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=B1=9E=E6=80=A7=E5=80=BC=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=93=8D=E4=BD=9C=E8=BF=9B=E8=A1=8C=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/product/spu/form/ProductAttributes.vue | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/views/mall/product/spu/form/ProductAttributes.vue b/src/views/mall/product/spu/form/ProductAttributes.vue index f2e8ae6a..613e2ede 100644 --- a/src/views/mall/product/spu/form/ProductAttributes.vue +++ b/src/views/mall/product/spu/form/ProductAttributes.vue @@ -37,7 +37,7 @@ v-for="item2 in item.propertyOpts" :key="item2.id" :label="item2.name" - :value="item2.name" + :value="item2.id" /> { if (inputValue.value) { // 重复添加校验 - if (attributeList.value[index].values.find((item) => item.name === inputValue.value)) { - message.warning('已存在相同属性值,请重试') - attributeIndex.value = null - inputValue.value = '' - return + if (isNumber(inputValue.value)) { + if (attributeList.value[index].values?.some((item) => item.id === inputValue.value)) { + message.warning('已存在相同属性值,请重试') + attributeIndex.value = null + inputValue.value = '' + return + } } // 保存属性值 try {