jk's notes
  • SwipeCell 滑动单元格

SwipeCell 滑动单元格

文档: https://vant-contrib.gitee.io/vant/#/zh-CN/swipe-cell

样式与单元格一样, 附加的是允许左右滑动显示附加按钮. 使用上, 它是一个容器, 用于组合一些组件和按钮.

<van-swipe-cell>
  <template #left>
    <van-button square type="primary" text="选择" />
  </template>
  <van-cell :border="false" title="单元格" value="内容" />
  <template #right>
    <van-button square type="danger" text="删除" />
    <van-button square type="primary" text="收藏" />
  </template>
</van-swipe-cell>

使用时使用插槽来定义两端的按钮.

默认插槽中可以放置任意组件, 包括这里的单元格, 还可以是 Card, 等其他组件.

常用事件是 before-close, 在滑块关闭时触发, 支持 Promise

before-close 的参数有 name (标识符), position (触发关闭的位置, 取值有: left, right, cell, 以及 outside).

Last Updated:
Contributors: jk