Vant weapp踩坑之滑動單元格SwipeCell右滑無樣式解決辦法


根據官方教程,在wxml里鍵入

<van-swipe-cell id="swipe-cell" right-width="{{ 65 }}" left-width="{{ 65 }}" async-close bind:close="onClose">
<view slot="left">選擇</view>
<van-cell-group>
<van-cell title="單元格" value="內容" />
</van-cell-group>
<view slot="right">刪除</view>
</van-swipe-cell>
,在.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;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM