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

View File

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

View File

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