From 2f0931f74b0ae313a36bddc3a21a7a4643e65956 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=92=A6?= <360013221@qq.com> Date: Thu, 9 May 2024 16:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=B8=8D=E5=90=8C=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/RoadAndEvents/utils/buttonEvent.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js index c724281d..4b14cc68 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/buttonEvent.js @@ -112,17 +112,21 @@ function resolveDataOptions(data, config, component, isDefault) { name: "", config: { markerClick: (extData, item) => { - const formData = (extData?.otherConfig && typeof extData?.otherConfig !== 'string') - ? JSON.parse(extData.otherConfig) - : null; + // 兼容不同的返回类型 + let formData = extData.otherConfig; + try{ + formData = JSON.parse(otherConfig) + }catch(e){ + formData = null; + } // formData.pictures = ["https://pic1.zhimg.com/80/v2-c00beaae1f6e3c09a6d77c16c70002fe_1440w.webp?source=1def8aca","https://pic1.zhimg.com/80/v2-c56626621906417a453d262ac11f3385_1440w.webp?source=1def8aca"] - console.log(component, "DialogComponent"); + // console.log(component, "DialogComponent",extData); this.dialogConfig = { component, data: { ...extData, formData, - parseOtherConfig: JSON.parse((extData.otherConfig && typeof extData.otherConfig !== 'string')|| "{}"), + parseOtherConfig: formData, _itemData: item, }, };