html,
body,
#container {
width: 100%;
height: 100%;
}
获取输入提示信息请输入关键字
//初始化地图
var map = new AMap.Map('container', {
resizeEnable: true, //是否监控地图容器尺寸变化
zoom: 11, //初始地图级别
});
// 获取输入提示信息
function autoInput(){
var keywords = document.getElementById("input").value;
AMap.plugin('AMap.Autocomplete', function(){
// 实例化Autocomplete
var autoOptions = {
city: '全国'
}
var autoComplete = new AMap.Autocomplete(autoOptions);
autoComplete.search(keywords, function(status, result) {
// 搜索成功时,result即是对应的匹配数据
var node = new PrettyJSON.view.Node({
el: document.querySelector("#input-info"),
data: result
});
})
})
}
autoInput();
document.getElementById("input").oninput = autoInput;