<template>
<div>
<el-amap-search-box class="search-box"
:search-option="searchOption"
:on-search-result="onSearchResult"></el-amap-search-box>
<el-amap vid="amapDemo"
:amap-manager="amapManager"
:center="center"
:zoom="zoom"
:events="mapEvents"
class="amap-demo">
</el-amap>
</div>
</template>
methods: {
onSearchResult(pois) {
if (pois.length > 0) {
this.longitude = pois[0].lng // 经度
this.latitude = pois[0].lat// 纬度
this.center = [this.longitude, this.latitude]
this.zoom = 18
}
},
}