根据官方教程,在wxml里键入
选择
删除
,在.js里键入
Page({
onClose(event) {
const { position, instance } = event.detail;
switch (position) {
case 'left':
case 'cell':
instance.close();
break;
case 'right':
Dialog.confirm({
message: '确定删除吗?'
}).then(() => {
instance.close();
});
break;
}
}
});
是得不到官方的效果如下的:
你会发现右边的删除是没有样式的,
因此,需要在wxss里添加上如下样式:
.van-swipe-cell__left,
.van-swipe-cell__right {
display: inline-block;
width: 65px;
height: 44px;
font-size: 15px;
line-height: 44px;
color: #fff;
text-align: center;
background-color: #f44;
}
才能有官方的效果,坑比
-------end---------