Skip to content

Cascader 多级联动

规则

js
{
    type:"cascader",
    title:"所在区域",
    field:"address",
    value:['陕西省','西安市','新城区'],
    props:{}
}
{
    type:"cascader",
    title:"所在区域",
    field:"address",
    value:['陕西省','西安市','新城区'],
    props:{}
}

参考:naive-ui_Cascader

value :Array

props

名称类型默认值说明版本
cascadebooleantrue在多选时是否关联选项
check-strategystring'all'设置勾选策略来指定显示的勾选节点,all 表示显示全部选中节点;parent 表示只显示父节点(当父节点下所有子节点都选中时,对于单选无效);child 表示只显示子节点;
children-fieldstring'children'替代 CascaderOption 中的 children 字段名
clearablebooleanfalse值是否可清除
disabledbooleanfalse是否禁用
expand-trigger'click' | 'hover''click'remote 被设定时 'hover' 不生效
filterablebooleanfalseremote 被设定时不生效
filter(pattern: string, option: CascaderOption, path: CascaderOption[]) => boolean一个基于字符串的过滤算法过滤选项的函数
value-fieldstring'value'替代 CascaderOption 中的 value 字段名
label-fieldstring'label'替代 CascaderOption 中的 label 字段名
max-tag-countnumber | 'responsive'undefined多选标签的最大显示数量,responsive 会将所有标签保持在一行
multiplebooleanfalse是否支持多选
optionsCascaderOption[][]填充的 options 数据
placeholderstring'请选择'提示信息
placement'top-start' | 'top' | 'top-end' | 'right-start' | 'right' | 'right-end' | 'bottom-start' | 'bottom' | 'bottom-end' | 'left-start' | 'left' | 'left-end' | 'bottom-start'弹出位置2.25.0
remotebooleanfalse是否远程获取数据
render-label(option: CascaderOption, checked: boolean) => VNodeChildundefinedCascader 菜单选项标签渲染函数2.24.0
separatorstring' / '数据分隔符
showbooleanundefined是否打开菜单
show-pathbooleantrue是否在选择器中显示选项路径
size'small' | 'medium' | 'large''medium'尺寸
virtual-scrollbooleantrue是否支持虚拟滚动
on-blur() => voidundefined用户 blur 时执行的回调
on-focus() => voidundefined用户 focus 时执行的回调
on-load(option: CascaderOption) => Promise<void>undefined在点击未加载完成节点时的回调,在返回的 promise 中设定 option.children,在返回的 promise resolve 或 reject 之后完成加载
on-update:show(value: boolean) => voidundefined菜单打开关闭的回调
on-update:value(value: string | number | Array<string | number> | null, option: CascaderOption | Array<CascaderOption | null> | null, pathValues: Array<CascaderOption | null> | Array<CascaderOption[] | null> | null) => voidundefined值改变时执行的回调