原有地图基础上增加搜索功能
解决:
1.amap.autocomplete搜索失效
2.amap.autocomplete的异常报错INVALID_USER_SCODE和USERKEY_PLAT_MOMATCH等
效果图:
安装依赖:npm i @amap-jsapi-loader -- s
地图组件页面:
<template>
<div class="content">
<div class="inp-box" v-if="props.iptVisible">
<a-input-search
placeholder="请输入地址关键词"
v-model="inpVal"
style="width: 100%"
@input="changeinp"
/>
<a-list
style="width: 100%"
max-height="200px"
v-if="addressList?.length || inpVal"
>
<a-list-item
v-for="item in addressList"
:key="item.id"
@click="clickItem(item)"
>
<p
style="
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
"
>
<icon-location style