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 {