【fix】优化代码
This commit is contained in:
@ -6,11 +6,13 @@ export default function (componentContent) {
|
||||
const { sendReq, beforeGetData, afterGetData, jumpProductDetail, jumpProList } = funMixin()
|
||||
|
||||
const productData = ref([])
|
||||
const loading = ref(true)
|
||||
onMounted(() => {
|
||||
getData(true)
|
||||
})
|
||||
|
||||
function getData (isFirst) {
|
||||
loading.value = true
|
||||
if (componentContent.value.productData.sourceType === '1') {
|
||||
if (
|
||||
componentContent.value.productData.productIdList?.length > 0
|
||||
@ -24,12 +26,14 @@ export default function (componentContent) {
|
||||
(proRes) => {
|
||||
afterGetData()
|
||||
productData.value = proRes.data.list
|
||||
loading.value = false
|
||||
if (isFirst) {
|
||||
componentContent.value.productData.imgTextData = productData.value
|
||||
}
|
||||
},
|
||||
() => {
|
||||
afterGetData()
|
||||
loading.value = false
|
||||
}
|
||||
)
|
||||
} else {
|
||||
@ -45,6 +49,7 @@ export default function (componentContent) {
|
||||
},
|
||||
(proRes) => {
|
||||
afterGetData()
|
||||
loading.value = false
|
||||
productData.value = proRes.data.list
|
||||
if (isFirst) {
|
||||
componentContent.value.productData.imgTextData = productData.value
|
||||
@ -53,6 +58,7 @@ export default function (componentContent) {
|
||||
},
|
||||
() => {
|
||||
afterGetData()
|
||||
loading.value = false
|
||||
}
|
||||
)
|
||||
} else {
|
||||
@ -73,6 +79,7 @@ export default function (componentContent) {
|
||||
productData,
|
||||
jumpProductDetail,
|
||||
jumpProList,
|
||||
getPercentageNum
|
||||
getPercentageNum,
|
||||
loading
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user