| | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { jsonp } from 'vue-jsonp' |
| | | |
| | | export default { |
| | | name: 'OperaShopWindow', |
| | | extends: BaseOpera, |
| | |
| | | }, |
| | | methods: { |
| | | searchAddress( ){ |
| | | if(this.geocoder && this.searchValue){ |
| | | this.geocoder.getLocation(this.searchValue) |
| | | if ( this.searchValue) { |
| | | var that = this |
| | | jsonp('https://apis.map.qq.com/ws/geocoder/v1/', { |
| | | address: this.searchValue, |
| | | key: 'HIDBZ-2QXL4-TAWUD-XET6Q-EKTJE-CCBSQ', |
| | | output: 'jsonp' |
| | | }).then(result => { |
| | | console.log(result) |
| | | if(result.result.location){ |
| | | that.changePostion(result.result.location.lng, result.result.location.lat) |
| | | } |
| | | }).catch(error => { |
| | | // 请求失败处理 |
| | | console.log(error) |
| | | }) |
| | | } |
| | | }, |
| | | initMap (lat, long) { |
| | |
| | | that.changePostion(event.latLng.lng, event.latLng.lat) |
| | | } |
| | | ) |
| | | this.geocoder = new qq.maps.Geocoder() |
| | | /* this.geocoder = new qq.maps.Geocoder() |
| | | this.geocoder.setComplete(function (result) { |
| | | that.changePostion(result.detail.location.lng,result.detail.location.lat) |
| | | }) |
| | | // 若服务请求失败,则运行以下函数 |
| | | this.geocoder.setError(function () { |
| | | console.log('逆解析失败') |
| | | }) |
| | | this.geocoder.setError(function (e) { |
| | | console.log(that.searchValue + '=====逆解析失败') |
| | | })*/ |
| | | }, |
| | | open (title, target) { |
| | | this.title = title |
| | |
| | | if(this.marker){ |
| | | this.marker.setMap(null) |
| | | } |
| | | var pos =new qq.maps.LatLng(lat,lng); |
| | | var pos = new qq.maps.LatLng(lat, lng) |
| | | this.map.setCenter(pos) |
| | | this.marker= new qq.maps.Marker({ |
| | | position: pos, |