Commit aaedfb07 by zhuzhequan

fix:修复podcn图片显示问题

parent 0eabaffd
......@@ -403,7 +403,7 @@
</ElFormItem>
<ElFormItem>
<span>
<ElButton type="primary" @click="search" ref="searchBtnRef"
<ElButton ref="searchBtnRef" type="primary" @click="search"
>查询</ElButton
>
</span>
......@@ -5150,20 +5150,33 @@ watch(
(newData) => {
if (!newData?.length) return
newData.forEach((order) => {
// 使用可选链和空值合并简化判断
order.productList?.forEach((product) => {
if (!product.previewImgs && product.imageAry) {
try {
product.previewImgs =
JSON.parse(product.imageAry)?.filter(
(el: { title: string }) => el.title,
) || []
} catch (error) {
console.error('JSON解析失败:', error)
product.previewImgs = []
}
const item = order as ProductList
if(item.imageAry){
if(item.imageAry.startsWith('http')){
item.imageAry = JSON.stringify(item.imageAry.split(',').map(e=>{
return {
url:e
}
}))
}
})
}
if(order.productList){
// 使用可选链和空值合并简化判断
order.productList?.forEach((product) => {
if (!product.previewImgs && product.imageAry) {
try {
product.previewImgs =
JSON.parse(product.imageAry)?.filter(
(el: { title: string }) => el.title,
) || []
} catch (error) {
console.error('JSON解析失败:', error)
product.previewImgs = []
}
}
})
}
})
},
{ deep: true, immediate: true }, // 添加immediate确保初始化时执行
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment