SwipeAction dingtalk only

SwipeAction 滑动操作

目前该组件库在钉钉小程序上,删除可能存在动画延迟的效果(微信小程序是好的),同比看了 vant 的 swipe-cell 也有同样的问题,疑似钉钉内核可能有问题,特此告知

代码示例

import { BfSwipeAction } from '@bud-fe/react-taro-ui';
import { View } from '@tarojs/components';
import React, { useState } from 'react';
export default () => {
const [test, setTest] = useState(false);
const [_dataList, setDataList] = useState([
{ id: 1, name: '3333' },
{ id: 2, name: '4444' },
{ id: 3, name: '5555' },
{ id: 4, name: '6666' },
]);
return (
<>
<View style={{ display: 'flex', flexDirection: 'column' }}>
{_dataList.map((item, index) => (
<View key={item.name}>
<BfSwipeAction
key={item.name}
content={
<View>
{item.id}~{item.name}
</View>
}
operation={[
{
text: '删除',
key: item.name + '1',
style: { color: '#ffffff', backgroundColor: '#FD3C42' },
onClick: () => {
// console.log(111);
setDataList((pre) => {
const oldList = [...pre];
oldList.splice(index, 1);
return oldList;
});
},
},
{ text: '预览', key: item.name + '2', style: 'color: #ffffff;background-color: #85673d' },
]}
operationWidth={270}
onContentClick={() => console.log(22222222)}
// autoClose
/>
</View>
))}
<BfSwipeAction
key={6666}
content={<View>这是奥迪姐我奥is的及附加爱睡觉</View>}
height={640}
operation={[
{
text: '删除',
style: { color: '#ffffff', backgroundColor: '#FD3C42' },
onClick: () => console.log(1111111),
},
{ text: '预览', style: { color: '#ffffff', backgroundColor: '#85673d' } },
]}
operationWidth={350}
onContentClick={() => console.log(22222222)}
autoClose
isOpened={test}
onOpenChange={(opened) => {
console.log('BfSwipeAction ====> ', opened);
setTest(opened);
}}
/>
</View>
</>
);
};

API

属性名描述类型默认值
height高度,自动转换成rpx,传750设计稿大小number120
content内容itemany--
operation操作按钮IBfSwipeActionOperation[]--
renderOperationItem自定义操作样式(item: IBfSwipeActionOperation) => any--
operationWidth滑块到底,自动转换成rpx,传750设计稿大小number(必选)
onContentClickitem点击() => void--
disabled禁止滑动boolean--
autoClose点击选项自动关闭boolean--
isOpened是否开启boolean--
onOpenChange滑块变化(opened: boolean) => void--
dumi10:24