1.4.2 • Published 5 years ago

dfws-antd-cascader v1.4.2

Weekly downloads
78
License
-
Repository
-
Last release
5 years ago

东方网升Ant Design版级联选择器组件。

发布

  1. 更改package.josn版本
  2. yarn run build
  3. npm publish 注:镜像源需切换回NPM官方源

链接

示例

  • cd example
  • npm install
  • npm start

使用之前

该组件依赖于Ant Design组件,使用之前请配置Ant Design。

何时使用

  • 需要从一组相关联的数据集合进行选择,例如省市区,公司层级,事物分类等。
  • 从一个较大的数据集合中进行选择时,用多级分类进行分隔,方便选择。
  • 比起 Select 组件,可以在同一个浮层中完成选择,有较好的体验。

API

<DfwsCascader code={['degree','skill-degree','language']} onChange={onChange} />
参数说明类型默认值
code级联codearray-
url字典服务URLstring-
cache字段缓存booleantrue
expireDay缓存日期number7
allowClear是否支持清除booleantrue
autoFocus自动获取焦点booleanfalse
changeOnSelect当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示booleanfalse
className自定义类名string-
defaultValue默认的选中项string[][]
disabled禁用booleanfalse
displayRender选择后展示的渲染函数(label, selectedOptions) => ReactNodelabel => label.join(' / ')
expandTrigger次级菜单的展开方式,可选 'click' 和 'hover'string'click'
getPopupContainer菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。示例Function(triggerNode)() => document.body
loadData用于动态加载选项,无法与 showSearch 一起使用(selectedOptions) => void-
notFoundContent当下拉列表为空时显示的内容string'Not Found'
options可选项数据源object-
placeholder输入框占位文本string'请选择'
popupClassName自定义浮层类名string-
popupPlacement浮层预设位置:bottomLeft bottomRight topLeft topRightEnumbottomLeft
popupVisible控制浮层显隐boolean-
showSearch在选择框中显示搜索框booleanfalse
size输入框大小,可选 large default smallstringdefault
style自定义样式string-
value指定选中项string[]-
onChange选择完成后的回调(value, selectedOptions) => void-
onPopupVisibleChange显示/隐藏浮层的回调(value) => void-

showSearch 为对象时,其中的字段:

参数说明类型默认值
filter接收 inputValue path 两个参数,当 path 符合筛选条件时,应返回 true,反之则返回 false。function(inputValue, path): boolean
matchInputWidth搜索结果列表是否与输入框同宽boolean
render用于渲染 filter 后的选项function(inputValue, path): ReactNode
sort用于排序 filter 后的选项function(a, b, inputValue)

方法

名称描述
blur()移除焦点
focus()获取焦点

注意,如果需要获得中国省市区数据,可以参考 china-division

参考

Ant Design

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.5-beta4

6 years ago

0.3.5-beta3

6 years ago

0.3.5-beta2

6 years ago

0.3.5-beta1

6 years ago

0.3.5-beta

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago