<template>
<view style="flex:1">
<view style="flex:1">
<map
style="flex:1;"
class="map"
:latitude="latitude"
:longitude="longitude"
:enable-traffic="true"
:markers="markers"
:enable-satellite="isOpenSatellite"
@updated="mapUpdated"
>
<view class="serach-box">
<uni-search-bar
:radius="20"
placeholder="请输入车牌进行搜索"
@confirm="search"
@input="hanldeInput"
></uni-search-bar>
</view>
<view class="serach-list">
<uni-list><uni-list-item v-for="item in searchList" :title="item" /></uni-list>
</view>
</map>
</view>
</view>
</template>
<script>
//import uniSearchBar from '@/components/uni-search-bar/uni-search-bar.vue'
export default {
components: {
//uniSearchBar
},
data() {
return {
id: 0, // 使用 marker点击事件 需要填写id
title: 'map',
latitude: 39.909,
longitude: 116.39742,
list: ['asd', 'bgh', 'aer', 'fdf'],
searchList: [],
isOpenSatellite: false, //是否开启卫星地图
markers: [
{
id: 1,
title: '粤A.2344S',
latitude: 39.909,
longitude: 116.39742,
iconPath: '../../../static/icon/marker.png',
width:30,
height:30,
label: {
content: '粤A.2344S'
}
},
{
id: 1,
title: '粤A.234eS',
latitude: 39.910,
longitude: 116.39745,
iconPath: 'dsdsada',
width:30,
height:30,
label: {
content: '粤A.2344S'
}
}
]
};
},
methods: {
search(value) {
console.log(value);
},
hanldeInput(obj) {
console.log(obj.value);
if (obj.value == '') {
this.searchList = [];
return;
}
this.searchList = this.list.filter(e => {
return e.indexOf(obj.value) != -1;
});
},
mapUpdated(e) {
//uni.hideLoading()
}
}
};
</script>
<style>
.serach-box {
}
</style>
没有显示自定义图标
3 个回复
9***@qq.com (作者)
显示的是蓝色的默认marker图标
9***@qq.com (作者)
已经解决
劉先森
怎么解决的,遇到同样的问题
2020-08-12 12:07
3***@qq.com
怎么解决的也说一下啊。, 不然发出来意义何在啊
2022-04-11 23:14
前端小郝
是不是需要required?