亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Google Maps Geocode意外的屬性位置

Google Maps Geocode意外的屬性位置

慕婉清6462132 2021-05-06 19:59:40
我正在嘗試為我的vue.js應用設置地址解析。我沒有使用任何第三方庫,只有通過npm安裝的google地圖。調用地址解析方法時,會引發錯誤,指出屬性位置意外。我已經嘗試過“位置”,“ latlng”,坐標本身等等。經度和緯度來自navigator.geolocation物體。這是我的安裝腳本的一部分:Vue.component('catalog', require('./components/Catalog'));Vue.component('address-autocomplete', require('./components/AddressAutoComplete'));window.googleMapsClient = require('@google/maps').createClient({    key: "MY_API_KEY"});還有我的Vue組件:getLocationFromGeoData() {    if (navigator.geolocation) {        navigator.geolocation.getCurrentPosition(            this.setLocation,            this.showError        );    } else {        showLocationError("Geolocation wird nicht unterstützt!");    }},setLocation(position) {    var self = this;    this.location.latitude = position.coords.latitude;    this.location.longitude = position.coords.longitude;    var latLng = {        lat: parseFloat(this.location.latitude),        lng: parseFloat(this.location.longitude)    };    googleMapsClient.geocode({'location': latLng}).asPromise()        .then((response) => {            self.location.address = results[1].formatted_address;        }).catch((err) => {            showLocationError(err);        });},
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 178 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號