使用Vant组件中SwipeCell组件踩的坑

uni-app中Vant SwipeCell组件样式修复
在uni-app开发中,使用Vant的SwipeCell组件遇到样式问题,组件显示效果与官方文档不符。为解决这个问题,需要手动编写样式以达到预期的演示效果。

使用Vant组件中SwipeCell组件踩的坑

根据Vant官方文档使用方法,使用组件SwipeCell,左右两边按钮并没有演示效果的样式,代码如下(uni-app开发)

<van-swipe-cell
      right-width="{{ 65 }}"
      v-for="(item, index) in memoryList"
      :key="index"
    >
      <van-cell-group>
        <van-card
          :desc="item.m_content"
          :title="item.m_title"
          :thumb="item.mi_url"
          :lazy-load="true"
        >
        </van-card>
      </van-cell-group>
      <view slot="right" class="van-swipe-cell__right" @click="deleteHandle()"
        >删除</view
      >
    </van-swipe-cell>

效果
在这里插入图片描述
和官方演示文档相差甚远。

解决方案

自己写样式:

  .van-swipe-cell__right {
	display: flex;
    width: 65px;
    height: 100%;
    font-size: 15px;
    line-height: 100%;
    color: #fff;
	align-items: center;
	justify-content: center;
    background-color: #f44;
  }

效果:

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值