SortableItem

SortableItem 排序列表项

代码示例

import { BfSortableGroup, BfSortableItem } from '@bud-fe/react-taro-ui';
import { View } from '@tarojs/components';
import React from 'react';
export default () => {
const handleOnItemClick = (id, newStatus) => {
console.log('handleOnItemClick', { id, newStatus });
};
const handleOnSortItemsChange = (sortItems) => {
console.log('handleOnSortItemsChange', sortItems);
};
return (
<>
<View className="group-title">SortableItem - 基础用法 </View>
<BfSortableItem status="UP" onItemClick={handleOnItemClick}>
<View>status="UP"</View>
</BfSortableItem>
<BfSortableItem status="DOWN" onItemClick={handleOnItemClick}>
<View>status="DOWN"</View>
</BfSortableItem>
<BfSortableItem onItemClick={handleOnItemClick}>
<View>status="UNKNOWN"</View>
</BfSortableItem>
<View className="group-title">SortableGroup - 基础用法 </View>
<BfSortableGroup
sortItems={[
{ label: 'item1', value: 1, status: 'UP' },
{ label: 'item2', value: 2 },
{ label: 'item3', value: 3 },
]}
onSortItemsChange={handleOnSortItemsChange}
/>
</>
);
};

API

BfSortableItem

属性名描述类型默认值
childrenchildrenany--
statusicon 状态"UP" | "DOWN" | "UNKNOWN"--
labelClass文字classstring--
onItemClick点击回调(key: Key, newStatus: string) => void--

BfSortableGroup

属性名描述类型默认值
sortItems排序列表数据TSortItem[]--
onSortItemsChange排序列表项改变的回调(sortItems: TSortItem[]) => void--
dumi10:24