Demo entry 6746420

no

   

Submitted by anonymous on May 30, 2018 at 06:42
Language: JavaScript. Code size: 1.1 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.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).