chore: 添加TODO注释;以更优雅的方式跳出循环

pull/495/head
黄兆琦 2024-08-13 10:11:09 +08:00
parent 372e2215f0
commit 24e69ecf36
3 changed files with 8 additions and 8 deletions

View File

@ -31,6 +31,7 @@
class="!w-30"
@blur="handleInputConfirm(index, item.id)"
@keyup.enter="handleInputConfirm(index, item.id)"
@change="handleInputConfirm(index, item.id)"
>
<el-option
v-for="item2 in item.propertyOpts"
@ -39,7 +40,6 @@
:value="item2.name"
/>
</el-select>
<!-- <el-input :id="`input${index}`" v-model="inputValue" class="!w-20" /> -->
<el-button
v-show="!inputVisible(index)"
class="button-new-tag ml-1"
@ -54,7 +54,6 @@
</template>
<script lang="ts" setup>
import { ElInput } from 'element-plus'
import * as PropertyApi from '@/api/mall/product/property'
import { PropertyAndValues } from '@/views/mall/product/spu/components'
import { propTypes } from '@/utils/propTypes'

View File

@ -99,15 +99,14 @@ const submitForm = async () => {
values: []
})
// emit
attrOption.value.forEach((item) => {
if (item.name === formData.value.name) {
emit('success', propertyId, item.id)
for (const element of attrOption.value) {
if (element.name === formData.value.name) {
emit('success', propertyId, element.id)
message.success(t('common.createSuccess'))
dialogVisible.value = false
//
throw new Error()
return
}
})
}
message.success(t('common.createSuccess'))
dialogVisible.value = false
} finally {
@ -127,6 +126,7 @@ const resetForm = () => {
const getAttrOption = async () => {
formLoading.value = true
try {
// TODO @
const data = await PropertyApi.getPropertyPage({ pageNo: 1, pageSize: 100 })
attrOption.value = data.list
} finally {

View File

@ -201,6 +201,7 @@ const generateSkus = (propertyList: any[]) => {
const getPropertyValueList = async (id, propertyId) => {
formLoading.value = true
try {
// TODO @
const data = await PropertyApi.getPropertyValuePage({ pageNo: 1, pageSize: 100, propertyId })
propertyList.value.find((item) => item.id === id).propertyOpts = data.list
} finally {