Commit aaedfb07 by zhuzhequan

fix:修复podcn图片显示问题

parent 0eabaffd
...@@ -403,7 +403,7 @@ ...@@ -403,7 +403,7 @@
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>
<span> <span>
<ElButton type="primary" @click="search" ref="searchBtnRef" <ElButton ref="searchBtnRef" type="primary" @click="search"
>查询</ElButton >查询</ElButton
> >
</span> </span>
...@@ -5150,20 +5150,33 @@ watch( ...@@ -5150,20 +5150,33 @@ watch(
(newData) => { (newData) => {
if (!newData?.length) return if (!newData?.length) return
newData.forEach((order) => { newData.forEach((order) => {
// 使用可选链和空值合并简化判断 const item = order as ProductList
order.productList?.forEach((product) => { if(item.imageAry){
if (!product.previewImgs && product.imageAry) { if(item.imageAry.startsWith('http')){
try { item.imageAry = JSON.stringify(item.imageAry.split(',').map(e=>{
product.previewImgs = return {
JSON.parse(product.imageAry)?.filter( url:e
(el: { title: string }) => el.title, }
) || [] }))
} catch (error) {
console.error('JSON解析失败:', error)
product.previewImgs = []
}
} }
}) }
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确保初始化时执行 { 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