需求如下:
编写代码发现的坑:
小程序map组件 使用border-radius 的时候,不生效;
解决办法:
使用cover-view 填满整个map组件
在cover-view里面 定义四个 小倒角 小倒角的颜色和底色一样
分别position定位到四个角上;就这么简单
代码如下:
<map class="w-100" :markers="covers" style="height: 70vh;" :latitude="latitude"
:longitude="longitude">
<view class="w-100 position-relative" style="height: 100%;">
<view class="position-absolute left-0 top-0" style="width: 20rpx;height: 20rpx;background:radial-gradient(40rpx at right bottom,transparent 50%,#ffffff 50%);" />
<view class="position-absolute right-0 top-0" style="width: 20rpx;height: 20rpx;background:radial-gradient(40rpx at left bottom,transparent 50%,#ffffff 50%);" />
<!-- <view class="position-absolute left-0 bottom-0" style="width: 20rpx;height: 20rpx;background:radial-gradient(40rpx at right top,transparent 50%,#ffffff 50%);" /> -->
<!-- <view class="position-absolute right-0 bottom-0" style="width: 20rpx;height: 20rpx;background:radial-gradient(40rpx at left top,transparent 50%,#ffffff 50%);" /> -->
</view>
</map>
核心代码:
background:radial-gradient(40rpx at left bottom,transparent 50%,#ffffff 50%);