Google地方信息自动完成 [英] Google Places Auto-Complete
问题描述
输入框已正确初始化,但不会产生任何建议。任何人都可以指出我做错了什么吗? 此处为代码。
The input box is initialized properly but it is not generating any suggestions. Can any one point out what I am doing wrong? Here is the code.
更新
我调查了这个问题。问题在于:
I have investigated the issue. The problem is in the line:
types: ['(cities)', '(regions)']
当我只指定一个类型类型时:['(cities)']
无论是地区还是城市
都可以。但是两种类型不能一起工作。尽管文档明确指出类型
是字符串数组,有效值是'建立','geocode','(区域)'和'(城市)'
when I specify only one type types: ['(cities)']
no matter region or cities
it works. But two types are not working together. Although the documentation clearly says that types
are Array of strings and valid values are 'establishment', 'geocode', '(regions)' and '(cities)'
推荐答案
正如文档:
$ b
As mentioned in the documentation:
类型,可以指定两种显式类型之一或者
这意味着类型
数组只支持一个参数。
This means that the types
array only supports one parameter.
如果您认为支持多个参数或显式类型和集合的混合是一项有用的功能,请将地点API - 功能请求。
If you think it would be a useful feature to support more than one parameter or a mixture of explicit types and collections, please file a Places API - Feature Request.
这篇关于Google地方信息自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!