1.0.0 • Published 2 years ago
taro-swipe-cell v1.0.0
taro-SwipeCell
基于Taro3、React的 taro SwipeCell 滑动单元格组件
复用性很低,主要提供一个思路, 使用ScrollView 会有在部分真机设备有兼容性问题;使用MovableView方式页面滑动就会有问题,目前这样思路是最优解决方案。
安装
npm install taro-SwipeCell
导入组件
import SwipeCell from 'taro-SwipeCell'
参数说明
参数 | 描述 | 类型 | 必传 | 默认值 |
---|---|---|---|---|
deleteItem | 删除事件 | Function | 是 | () => void |
children | children | React.children | 是 |
使用
import { FC, memo } from 'react'
import MySwipeCell from 'taro-SwipeCell'
import Taro from '@tarojs/taro'
import { View } from '@tarojs/components'
const Component: FC = () => {
// 删除当前item
const delItem = item => {
}
return (
<>
<MySwipeCell deleteItem={() => delItem(item)}>
<View className={styles.item}>
1111
</View>
</MySwipeCell>
</>
)
}
const Mall = memo(Component)
export default Mall
1.0.0
2 years ago