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 +++++++++++++++++++++--------------- 1 files changed, 42 insertions(+), 31 deletions(-) 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> -- Gitblit v1.8.0