滑动操作 SwipeAction

基本

  1. <za-swipe-action autoClose @close="handleClose" @open="handleOpen" :right="action1">
  2. <za-cell>左滑看看(自动关闭)</za-cell>
  3. </za-swipe-action>
  4. <za-swipe-action @close="handleClose" @open="handleOpen" :left="action1">
  5. <za-cell>右滑看看</za-cell>
  6. </za-swipe-action>
  7. <za-swipe-action @close="handleClose" @open="handleOpen" :left="action1" :right="action1">
  8. <za-cell>左右都能滑动</za-cell>
  9. </za-swipe-action>

Vue Script

  1. <script name="vue">
  2. export default {
  3. data() {
  4. return {
  5. action1:[
  6. {
  7. theme: 'error',
  8. text: '右按钮1',
  9. onClick: () => console.log('右按钮1'),
  10. },
  11. {
  12. theme: 'success',
  13. text: '右按钮2',
  14. onClick: () => console.log('右按钮2'),
  15. },
  16. ]
  17. }
  18. },
  19. methods: {
  20. handleClose(reason) {
  21. console.log(reason);
  22. },
  23. handleOpen(reason) {
  24. console.log(reason);
  25. },
  26. },
  27. };
  28. </script>

API

SwipeAction Attributes

属性类型默认值可选值/参数说明
leftarrayOf(object)[ ]object: { theme, text, onClick }左侧按钮组
rightarrayOf(object)[ ]object: { theme, text, onClick }右侧按钮组
auto-closebooleanfalse点击按钮是否自动关闭
disabledbooleanfalse是否禁用
offsetnumber10回弹偏移的距离
move-distance-rationumber0.5移动距离比例临界点
move-time-spannumber300移动时间跨度临界点
animation-durationnumber300动画执行时间,单位:毫秒

SwipeAction Events

事件名称说明回调参数
open打开时的事件direaction, 可能值 left, right
close关闭时的事件reason, 可能值 retract, touchaway

SwipeAction 滑动操作 - 图1