当我尝试运行地图。它在控制台中给出如下输出:
_.Re {lat: ƒ, lng: ƒ}
lat: ƒ ()
arguments: null
caller: null
length: 0
name: ""
prototype: {constructor: ƒ}
[[FunctionLocation]]: js?key=AIzaSyDBLdIb7…s_8&sensor=false:77
[[Prototype]]: ƒ ()
[[Scopes]]: Scopes[3]
0: Closure (_.Re) {d: 32.80198280861661, e: -97.26947303917295}
1: Closure {_: {…}, baa: ƒ, daa: ƒ, qa: ƒ, ta: ƒ, …}
2: Global {0: Window, window: Window, self: Window, document: document, name: '', location: Location, …}
lng: ƒ ()
arguments: null
caller: null
length: 0
name: ""
prototype: {constructor: ƒ}
[[FunctionLocation]]: js?key=AIzaSyDBLdIb7…s_8&sensor=false:77
[[Prototype]]: ƒ ()
[[Scopes]]: Scopes[3]
[[Prototype]]: Object
这就是我在代码中使用它并调用映射的方式。try and catch
xhr.onload = function(){
if(this.status == 200){
const users = JSON.parse(this.responseText);
console.log(users.businesses);
length = users.businesses.length
let lat = 32.75
let lng = -97.13
// if (lat!= 32.75 || lng!=-97.13)
try {
console.log(map.getCenter())
} catch (error) {
console.log(error)
}
initMap(length,users,lat,lng)
}
}
Afaik它应该只返回经纬度的坐标
是我的错。我试图通过Map.getCenter()访问它。但它应该是Map.getCenter().lat()