From 9086f457d6404a0cd7f74b351c3889f82d02a91d Mon Sep 17 00:00:00 2001
From: guoshipeng <3194674006@qq.com>
Date: Mon, 14 Aug 2023 17:17:09 +0800
Subject: [PATCH] fix:修改
---
src/components/map/pickCoordinate1.vue | 73 +++++++++++++++++++++---------------
public/index.html | 2
src/main.ts | 2
3 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/public/index.html b/public/index.html
index be543a4..c773f97 100644
--- a/public/index.html
+++ b/public/index.html
@@ -137,7 +137,7 @@
window._AMapSecurityConfig = {
securityJsCode: '20fcbbc1782d2853f433831e61fab769',
}
-
+
</script>
</html>
\ No newline at end of file
diff --git a/src/components/map/pickCoordinate1.vue b/src/components/map/pickCoordinate1.vue
index 8016aba..a114ea1 100644
--- a/src/components/map/pickCoordinate1.vue
+++ b/src/components/map/pickCoordinate1.vue
@@ -12,18 +12,21 @@
<div style="display: flex">
<div style="display: flex; width: 300px">
<div>���������</div>
- <a-input
+ <!-- <a-input
placeholder="���������������"
id="tipinput"
style="width: 160px; height: 26px"
- ></a-input>
- <!-- <a-input
+ ></a-input> -->
+ <a-input
v-model="input"
placeholder="���������������"
id="tipinput"
style="width: 160px; height: 26px"
@change="searchMap"
- ></a-input> -->
+ ></a-input>
+ <!-- <input v-model="input" id="tipinput" /><button @click="searchAddress">
+ ������
+ </button> -->
<!-- <a-button
size="small"
type="primary"
@@ -156,44 +159,43 @@
// this.zoom = 19
// }
- private selectPoi(e){
- console.log(e);
- let poi = e
- if (poi.length > 0) {
- this.clickPoint = [poi[0].lng, poi[0].lat]
- }
- }
+ // private selectPoi(e){
+ // console.log(e);
+ // let poi = e
+ // if (poi.length > 0) {
+ // this.clickPoint = [poi[0].lng, poi[0].lat]
+ // }
+ // }
private input:any=''
private mark:any=''
private searchMap(){
var autoOptions = {
input: "tipinput"
};
- var auto = new AMap.AutoComplete(autoOptions);
- const placeSearch = new AMap.PlaceSearch(this.input);
- console.log(window);
+ var self=this
+ var auto = new AMap.Autocomplete(autoOptions);
+ const placeSearch = new AMap.PlaceSearch(self.input);
+ // console.log(window);
auto.on("select", select);//������������������������������������������������
function select(e) {
- console.log(e.poi.adcode);
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name); //���������������������
+ self.clickPoint = [e.poi.location.lng, e.poi.location.lat]
}
-
- // ���������������
- // console.log(this.input);
- // placeSearch.search(this.input, (status, result) => {
- // // ������������������result������������������POI������
-
- // console.log(result);//���������������������������������������������������������������������������
- // });
- // // ������������������������
- // AMap.event.addListener(placeSearch, "selectChanged", (SelectChangeEvent) => {
- // // ������������������������������������������
- // this.mark = SelectChangeEvent.selected.data;
- // console.log(SelectChangeEvent.selected.data,'������');
- // });
-
}
+ // private searchAddress() {
+ // var placeSearch = new AMap.PlaceSearch({
+ // pageSize: 5, // ������������������������
+ // pageIndex: 1, // ������
+ // city: "������", // ���������������
+ // citylimit: true, //���������������������������������������������
+ // panel: "panel", // ���������������������������������������������
+ // autoFitView: true // ������������������������������������������ Marker���������������������������������
+ // });
+ // //���������������
+ // placeSearch.search('������������');
+
+ // }
// ���������������������������
private clickPoint: any = this.lnglat === '' ? [
120.720262,
@@ -268,9 +270,18 @@
}
.amap-sug-result {
position: absolute;
- z-index: 9999 !important;;
+ z-index: 9999 !important;
background-color: #fefefe;
border: 1px solid #d1d1d1;
bottom: auto;
}
+#panel {
+ z-index: 999;
+ position: absolute;
+ background-color: white;
+ max-height: 100%;
+ overflow-y: auto;
+ right: 0;
+ width: 280px;
+}
</style>
diff --git a/src/main.ts b/src/main.ts
index ad8ffc2..838b768 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -20,7 +20,7 @@
key: 'c4e73f2c6972766d6a54dffd2f501cac',
plugin: ['AMap.moveAnimation', 'AMap.PlaceSearch', 'AMap.Scale',
'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor',
- 'AMap.DistrictSearch', 'AMap.Geocoder', 'AMap.AutoComplete'],
+ 'AMap.DistrictSearch', 'AMap.Geocoder', 'AMap.Autocomplete'],
// ������������ sdk ��������� 1.4.4
v: '1.4.4'
})
--
Gitblit v1.8.0