view class=flex-item image class=photo src=item mode=aspectFillimage view view class=flex-item0 button class=delete-
可以使用position属性来实现将按钮放在图片的右上角。具体的代码如下所示:
<view class="flex-item">
<image class="photo" src="{{item}}" mode="aspectFill"></image>
<button class="delete-btn" data-index="{{index}}" bindtap="deleteImage" type="primary" size="mini">删除</button>
</view>
然后,在CSS中添加以下代码:
.flex-item {
position: relative;
}
.photo {
width: 100%;
height: auto;
}
.delete-btn {
position: absolute;
top: 0;
right: 0;
}
这样,按钮就会被定位在图片的右上角。
原文地址: https://www.cveoy.top/t/topic/ioHG 著作权归作者所有。请勿转载和采集!