Cascader dingtalk only

Cascader 级联选择器

代码示例

import { BfCascader } from '@bud-fe/react-taro-ui';
import { IMultiLevelNode } from '@bud-fe/react-taro-ui/es/components/bf-cascader';
import React from 'react';
const data: IMultiLevelNode[] = [
{
name: '中国',
code: '1',
level: 1,
subList: [
{ name: '北京', code: '11', level: 2, parentCode: '1' },
{
name: '上海',
code: '12',
level: 2,
parentCode: '1',
subList: [{ name: '黄浦区', code: '121', level: 3, parentCode: '12' }],
},
],
},
];
export default () => {
return (
<>
<BfCascader
visible
maxLevel={3}
title="请选择省市区"
data={data}
onOk={(values) => {
console.log('onOk', values);
}}
onCancel={() => {
console.log('onCancel');
}}
/>
</>
);
};

API

属性名描述类型默认值
title卡片标题string'请选择'
breadcrumbPlaceholder面包屑占位字符string'请选择'
toast未选择完成时提示string'请先完成选择'
data数据源IMultiLevelNode[]--
visible是否可见booleanfalse
values已选数据string[]--
maxLevel最大层级,面包屑节点固定数量,isDynamicLevel为true时无效.number(必选)
fieldNames自定义节点属性名称{ name: string; code: string; level: string; subList: string; }{ name: 'name', code: 'code', level: 'level', subList: 'subList' }
onOk选择完成回调(values: IMultiLevelNode[]) => void--
onCancel取消选择回调() => void--
onInitFinished初始化完成回调(data: IMultiLevelNode[], values: IMultiLevelNode[]) => void--
dumi10:24