美文网首页
Taro AtSwipeAction不生效解决方案

Taro AtSwipeAction不生效解决方案

作者: 时间煮鱼 | 来源:发表于2022-01-05 11:42 被阅读0次

使用版本 ---> "taro-ui": "^3.0.0-alpha.3"
界面效果:


image.png

使用AtSwipeAction不生效,官方文档书写不全,需要添加两个属性
1.maxDistance 滑块最大滑动距离,一般是按钮个数乘以按钮宽度
2.areaWidth 组件宽度 (如果不引用导致组件占位宽度为0,页面不显示)

 <AtSwipeAction
  maxDistance={80}
  areaWidth={Taro.getSystemInfoSync().windowWidth * 0.88} // 适配不同手机系统屏幕宽度
  autoClose
  key={v.examineId}
  options={[
    {
      text: '删除',
      style: {
        backgroundColor: '#FF4949',
        width: '16px'
      },
      onClick: () => {
        console.log(123)
      }
    }
  ]}
  onClick={item => {
      item.onClick && item.onClick();
    }
  }
>
  <View className='card-items'>
    ...
  </View>
</AtSwipeAction>

相关文章

网友评论

      本文标题:Taro AtSwipeAction不生效解决方案

      本文链接:https://www.haomeiwen.com/subject/ppvhcrtx.html