获取地理位置

getCity () {
            const map = new BMap.Map('map');
            const nowCity = new BMap.LocalCity();
            nowCity.get(bdGetPosition);
            const _this = this;
            function bdGetPosition (result) {
                var cityName = result.name;
                _this.pickerData && _this.pickerData[0].forEach(item => {
                    item.children.forEach(value => {
                        if (value.text === cityName) {
                            _this.pickerDefaultValue = [item.value, value.value]
                        }
                    })
                })
            }
        },

posted @ 2021-03-15 09:51  未几  阅读(106)  评论(0)    收藏  举报