Demo entry 6746425

no

   

Submitted by anonymous on May 30, 2018 at 06:50
Language: JavaScript. Code size: 1.2 kB.

            AMap.plugin(['AMap.Autocomplete', 'AMap.PlaceSearch'], function() {
                var autoOptions = {
                    city: "西安", //城市,默认全国
                    input: "keyword" //使用联想输入的input的id
                };
                var autocomplete = new AMap.Autocomplete(autoOptions);
                var placeSearch = new AMap.PlaceSearch({
                    pageSize: 1,
                    city: '西安',
                    map: map
                })
                AMap.event.addListener(autocomplete, "select", function(e) {
                    placeSearch.setCity("西安");
                    AMap.service('AMap.Walking', function() { //回调函数
                        walking = new AMap.Walking({
                            panel: "panel",
                            city: '西安',
                            map: map
                        });
                        walking.search([{
                            keyword: e.poi.name
                        }, {
                            keyword: '西安电子科技大学B栋教学楼'
                        }], function(status, result) {});
                    })
                });
            });

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).