diff --git a/src/views/demo/degraining/curbspotcity/MapList/ShowInfoModal/index.vue b/src/views/demo/degraining/curbspotcity/MapList/ShowInfoModal/index.vue index 83b4e413..3ee9b6fd 100644 --- a/src/views/demo/degraining/curbspotcity/MapList/ShowInfoModal/index.vue +++ b/src/views/demo/degraining/curbspotcity/MapList/ShowInfoModal/index.vue @@ -503,24 +503,22 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e): void { + isInitImageLisener.value = false; if (e && !isInitImageLisener.value) { setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if (targetNode[0].getAttribute(mutation.attributeName).match('http')) { - handlerPreviewImage(0, targetNode[0].getAttribute(mutation.attributeName)); + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); } } - } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) }, 250); } } diff --git a/src/views/demo/illegalmining/curbspotcity/MapList/ShowInfoModal/index.vue b/src/views/demo/illegalmining/curbspotcity/MapList/ShowInfoModal/index.vue index 618bd033..5d127c8d 100644 --- a/src/views/demo/illegalmining/curbspotcity/MapList/ShowInfoModal/index.vue +++ b/src/views/demo/illegalmining/curbspotcity/MapList/ShowInfoModal/index.vue @@ -502,24 +502,22 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e): void { + isInitImageLisener.value = false; if (e && !isInitImageLisener.value) { setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if (targetNode[0].getAttribute(mutation.attributeName).match('http')) { - handlerPreviewImage(0, targetNode[0].getAttribute(mutation.attributeName)); + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); } } - } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) }, 250); } } diff --git a/src/views/demo/illegalmining/curbspotcity/MapList/SplitPolygonModal/index.vue b/src/views/demo/illegalmining/curbspotcity/MapList/SplitPolygonModal/index.vue index 9a437523..dde9e94d 100644 --- a/src/views/demo/illegalmining/curbspotcity/MapList/SplitPolygonModal/index.vue +++ b/src/views/demo/illegalmining/curbspotcity/MapList/SplitPolygonModal/index.vue @@ -888,25 +888,23 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e):void{ - if(e && !isInitImageLisener.value){ - setTimeout(function(){ + isInitImageLisener.value = false; + if (e && !isInitImageLisener.value) { + setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if(targetNode[0].getAttribute(mutation.attributeName).match("http")){ - handlerPreviewImage(0,targetNode[0].getAttribute(mutation.attributeName)) - } - } + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); + } } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; - },250) + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) + }, 250); } } diff --git a/src/views/demo/inspectionaudit/curbspotcity/MapList/ShowInfoModal/index.vue b/src/views/demo/inspectionaudit/curbspotcity/MapList/ShowInfoModal/index.vue index f4e8893b..a9380b22 100644 --- a/src/views/demo/inspectionaudit/curbspotcity/MapList/ShowInfoModal/index.vue +++ b/src/views/demo/inspectionaudit/curbspotcity/MapList/ShowInfoModal/index.vue @@ -522,24 +522,22 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e): void { + isInitImageLisener.value = false; if (e && !isInitImageLisener.value) { setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if (targetNode[0].getAttribute(mutation.attributeName).match('http')) { - handlerPreviewImage(0, targetNode[0].getAttribute(mutation.attributeName)); + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); } } - } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) }, 250); } } diff --git a/src/views/demo/keyproblem/keyissuesI/curbspotcity/MapList/ShowInfoModal/index.vue b/src/views/demo/keyproblem/keyissuesI/curbspotcity/MapList/ShowInfoModal/index.vue index bb6a4688..063a0a51 100644 --- a/src/views/demo/keyproblem/keyissuesI/curbspotcity/MapList/ShowInfoModal/index.vue +++ b/src/views/demo/keyproblem/keyissuesI/curbspotcity/MapList/ShowInfoModal/index.vue @@ -400,24 +400,22 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e): void { + isInitImageLisener.value = false; if (e && !isInitImageLisener.value) { setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if (targetNode[0].getAttribute(mutation.attributeName).match('http')) { - handlerPreviewImage(0, targetNode[0].getAttribute(mutation.attributeName)); + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); } } - } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) }, 250); } } diff --git a/src/views/demo/keyproblem/keyissuesII/curbspotcity/MapList/ShowInfoModal/index.vue b/src/views/demo/keyproblem/keyissuesII/curbspotcity/MapList/ShowInfoModal/index.vue index 992476ec..8d1a5f52 100644 --- a/src/views/demo/keyproblem/keyissuesII/curbspotcity/MapList/ShowInfoModal/index.vue +++ b/src/views/demo/keyproblem/keyissuesII/curbspotcity/MapList/ShowInfoModal/index.vue @@ -386,24 +386,22 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e): void { + isInitImageLisener.value = false; if (e && !isInitImageLisener.value) { setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if (targetNode[0].getAttribute(mutation.attributeName).match('http')) { - handlerPreviewImage(0, targetNode[0].getAttribute(mutation.attributeName)); + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); } } - } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) }, 250); } } diff --git a/src/views/demo/minerals/patchsummary/detail/index.vue b/src/views/demo/minerals/patchsummary/detail/index.vue index f02815b1..7f9503c0 100644 --- a/src/views/demo/minerals/patchsummary/detail/index.vue +++ b/src/views/demo/minerals/patchsummary/detail/index.vue @@ -870,24 +870,22 @@ const isInitImageLisener = ref(false); // 监听预览图片地址变化进行箭头切换 function handlerImageChange(e): void { + isInitImageLisener.value = false; if (e && !isInitImageLisener.value) { setTimeout(function () { const targetNode = document.getElementsByClassName('ant-image-preview-img'); - // 创建一个观察器实例,并传入回调函数 - const observer = new MutationObserver((mutationsList) => { - for (const mutation of mutationsList) { - if (mutation.type === 'attributes') { - if (targetNode[0].getAttribute(mutation.attributeName).match('http')) { - handlerPreviewImage(0, targetNode[0].getAttribute(mutation.attributeName)); + targetNode?.forEach((node,index)=>{ + let imageObserver = new MutationObserver((mutationsList)=>{ + for(const mutation of mutationsList){ + if (node.getAttribute(mutation.attributeName).match('http')){ + handlerPreviewImage(0, node.getAttribute(mutation.attributeName)); } } - } - }); - // 配置观察选项 - const config = { attributes: true }; - // 开始观察目标节点 - observer.observe(targetNode[0], config); - isInitImageLisener.value = true; + }) + const config = { attributes: true }; + imageObserver.observe(node, config); + isInitImageLisener.value = true; + }) }, 250); } }