From f644cc58c19a15f9ed399dd09776f40d668b20ac Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Tue, 2 Jul 2024 17:33:48 +0800 Subject: [PATCH] =?UTF-8?q?avue-plugin-map=E8=A1=A5=E4=B8=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + patches/avue-plugin-map+1.0.1.patch | 33 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 patches/avue-plugin-map+1.0.1.patch diff --git a/package.json b/package.json index cf2c808..2c8a379 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "dev": "vue-cli-service serve", "build:prod": "vue-cli-service build", "build:stage": "vue-cli-service build --mode staging", + "postinstall": "patch-package", "preview": "node build/index.js --preview", "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", "lint": "eslint --ext .js,.vue src", diff --git a/patches/avue-plugin-map+1.0.1.patch b/patches/avue-plugin-map+1.0.1.patch new file mode 100644 index 0000000..41f6bfa --- /dev/null +++ b/patches/avue-plugin-map+1.0.1.patch @@ -0,0 +1,33 @@ +diff --git a/node_modules/avue-plugin-map/packages/map/src/main.vue b/node_modules/avue-plugin-map/packages/map/src/main.vue +index 877fc0a..4d8e385 100644 +--- a/node_modules/avue-plugin-map/packages/map/src/main.vue ++++ b/node_modules/avue-plugin-map/packages/map/src/main.vue +@@ -174,8 +174,11 @@ export default { + }); + }, + init (callback) { ++ const satellite = new AMap.TileLayer.Satellite(); ++ const roadNet = new AMap.TileLayer.RoadNet(); + this.map = new window.AMap.Map("map__container", { + zoom: 13, ++ layers: [satellite, roadNet], + center: (() => { + if (this.longitude && this.latitude) { + return [this.longitude, this.latitude]; +@@ -183,9 +186,16 @@ export default { + })() + }); + this.initPoip(); ++ this.initToolbar(); + this.addClick(); + callback(); + }, ++ initToolbar () { ++ this.map.plugin(["AMap.ToolBar"],() => { ++ //加载工具条 ++ this.map.addControl(new AMap.ToolBar()); ++ }); ++ }, + initPoip () { + window.AMapUI.loadUI(["misc/PoiPicker"], PoiPicker => { + var poiPicker = new PoiPicker({