【发布时间】:2017-12-13 04:56:59
【问题描述】:
目前我正在从事 ionic 3 项目,我可以使用谷歌地图,我想使用谷歌地点自动完成功能,我使用这个答案 Answer 来解决问题“找不到名称 google”,当我输入 let input = new google.maps.places.Autocomplete(element);时
它工作了,现在应用程序运行了,但现在我得到了新的错误
'ERROR TypeError: Cannot read property 'Autocomplete' of undefined'
我该怎么办?
编辑(1)
当我使用console.log(google.maps); 时,我得到了结果,但是当我使用console.log(google.maps.places); 时,我得到了未定义。
但是当我在 VSCode 中点击places时,它显示它存在
export module places {
export class Autocomplete extends MVCObject {
constructor(inputField: HTMLInputElement, opts?: AutocompleteOptions);
getBounds(): LatLngBounds;
getPlace(): PlaceResult;
setBounds(bounds: LatLngBounds|LatLngBoundsLiteral): void;
setComponentRestrictions(restrictions: ComponentRestrictions): void;
setTypes(types: string[]): void;
}
etc etc
【问题讨论】:
标签: google-maps ionic-framework autocomplete ionic3