From 310156b7244cd7b0c1b958f4267b5cf4e12bd90a Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期五, 08 三月 2024 17:15:45 +0800 Subject: [PATCH] fix:修改获取实例 --- src/views/daoAnOffice/center/map.vue | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/views/daoAnOffice/center/map.vue b/src/views/daoAnOffice/center/map.vue index 3600a7d..37ccf57 100644 --- a/src/views/daoAnOffice/center/map.vue +++ b/src/views/daoAnOffice/center/map.vue @@ -42,7 +42,7 @@ </template> <script setup> -import { onMounted, ref,getCurrentInstance } from 'vue'; +import { onMounted, ref, getCurrentInstance } from 'vue'; import AMapLoader from '@amap/amap-jsapi-loader'; import DialogType1 from './dialog/dialog-type1.vue'; @@ -80,7 +80,7 @@ // dialog闆嗗悎 const dialogList = ref({}); // 鑾峰彇褰撳墠瀹炰緥 -const {ctx} = getCurrentInstance(); +let ctx = null; let mapInstance = null; let trafficLayer = null;; @@ -285,6 +285,8 @@ onMounted(() => { + // 鑾峰彇褰撳墠瀹炰緥 + ctx = getCurrentInstance().ctx; AMapLoader.load({ key: "2898109c22191c3969957500934169dc", //鐢宠濂界殑 Web 绔紑鍙戣�� Key锛岄娆¤皟鐢� load 鏃跺繀濉� version: "2.0", //鎸囧畾瑕佸姞杞界殑 JS API 鐨勭増鏈紝缂虹渷鏃堕粯璁や负 1.4.15 -- Gitblit v1.8.0