AutocompleteService class
google.maps.places.AutocompleteService
class
包含與擷取自動完成預測結果相關的方法。
撥打 const {AutocompleteService} = await google.maps.importLibrary("places")
即可存取。
請參閱「Maps JavaScript API 中的程式庫」。
建構函式 | |
---|---|
AutocompleteService |
AutocompleteService() 參數:無
建立 AutocompleteService 的新例項。 |
方法 | |
---|---|
getPlacePredictions |
getPlacePredictions(request[, callback]) 參數:
傳回值:
Promise<AutocompleteResponse> 根據提供的自動完成要求,擷取地點自動完成預測結果。 |
getQueryPredictions |
getQueryPredictions(request, callback) 參數:
傳回值:無
根據提供的查詢自動完成要求,擷取查詢自動完成預測結果。 |
AutocompletionRequest 介面
google.maps.places.AutocompletionRequest
介面
要傳送至 AutocompleteService.getPlacePredictions
的自動完成要求。
屬性 | |
---|---|
input |
類型:
string 使用者輸入的字串。 |
|
類型: LatLngBounds| |