扫一扫分享
Algolia Places是一个Javascript库,能让你在网页轻易实现搜索栏自动完成功能 。
npm install places.js --save
cdn引入
<script src="https://cdn.jsdelivr.net/npm/places.js@1.16.4"></script>
<input type="search" id="address-input" placeholder="Where are we going?" />
<script>
var placesAutocomplete = places({
appId: <YOUR_PLACES_APP_ID>,
apiKey: <YOUR_PLACES_API_KEY>,
container: document.querySelector('#address-input')
});
</script>
手机预览