fix: `Cascader` `option.value` supports `String` `Number` type
parent
dfc46a0de7
commit
dbc0b2eaeb
|
@ -10,7 +10,7 @@
|
|||
| allowClear | whether allow clear | boolean | true |
|
||||
| autoFocus | get focus when component mounted | boolean | false |
|
||||
| changeOnSelect | change value on each selection if set to true, see above demo for details | boolean | false |
|
||||
| defaultValue | initial selected value | string\[] | \[] |
|
||||
| defaultValue | initial selected value | string\[] \| number\[] | \[] |
|
||||
| disabled | whether disabled select | boolean | false |
|
||||
| displayRender | render function of displaying selected options, you can use slot="displayRender" and slot-scope="{labels, selectedOptions}" | `({labels, selectedOptions}) => vNode` | `labels => labels.join(' / ')` |
|
||||
| expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | 'click' |
|
||||
|
@ -27,7 +27,7 @@
|
|||
| showSearch | Whether show search input in single mode. | boolean\|object | false |
|
||||
| size | input size, one of `large` `default` `small` | string | `default` |
|
||||
| suffixIcon | The custom suffix icon | string \| VNode \| slot | - |
|
||||
| value(v-model) | selected value | string\[] | - |
|
||||
| value(v-model) | selected value | string\[] \| number\[] | - |
|
||||
|
||||
Fields in `showSearch`:
|
||||
|
||||
|
|
|
@ -21,11 +21,11 @@ import { cloneElement } from '../_util/vnode';
|
|||
import warning from '../_util/warning';
|
||||
|
||||
const CascaderOptionType = PropTypes.shape({
|
||||
value: PropTypes.string,
|
||||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
label: PropTypes.any,
|
||||
disabled: PropTypes.bool,
|
||||
children: PropTypes.array,
|
||||
key: PropTypes.string,
|
||||
key: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
}).loose;
|
||||
|
||||
const FieldNamesType = PropTypes.shape({
|
||||
|
@ -49,9 +49,9 @@ const CascaderProps = {
|
|||
/** 可选项数据源 */
|
||||
options: PropTypes.arrayOf(CascaderOptionType).def([]),
|
||||
/** 默认的选中项 */
|
||||
defaultValue: PropTypes.arrayOf(PropTypes.string),
|
||||
defaultValue: PropTypes.array,
|
||||
/** 指定选中项 */
|
||||
value: PropTypes.arrayOf(PropTypes.string),
|
||||
value: PropTypes.array,
|
||||
/** 选择完成后的回调 */
|
||||
// onChange?: (value: string[], selectedOptions?: CascaderOptionType[]) => void;
|
||||
/** 选择后展示的渲染函数 */
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
| allowClear | 是否支持清除 | boolean | true |
|
||||
| autoFocus | 自动获取焦点 | boolean | false |
|
||||
| changeOnSelect | 当此项为 true 时,点选每级菜单选项值都会发生变化,具体见上面的演示 | boolean | false |
|
||||
| defaultValue | 默认的选中项 | string\[] | \[] |
|
||||
| defaultValue | 默认的选中项 | string\[] \| number\[] | \[] |
|
||||
| disabled | 禁用 | boolean | false |
|
||||
| displayRender | 选择后展示的渲染函数,可使用slot="displayRender" 和 slot-scope="{labels, selectedOptions}" | `({labels, selectedOptions}) => vNode` | `labels => labels.join(' / ')` |
|
||||
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | 'click' |
|
||||
|
@ -27,7 +27,7 @@
|
|||
| showSearch | 在选择框中显示搜索框 | boolean | false |
|
||||
| size | 输入框大小,可选 `large` `default` `small` | string | `default` |
|
||||
| suffixIcon | 自定义的选择框后缀图标 | string \| VNode \| slot | - |
|
||||
| value(v-model) | 指定选中项 | string\[] | - |
|
||||
| value(v-model) | 指定选中项 | string\[] \| number\[] | - |
|
||||
|
||||
`showSearch` 为对象时,其中的字段:
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ export const menuProps = {
|
|||
theme: PropTypes.oneOf(['light', 'dark']).def('light'),
|
||||
mode: MenuMode.def('vertical'),
|
||||
selectable: PropTypes.bool,
|
||||
selectedKeys: PropTypes.arrayOf(PropTypes.string),
|
||||
selectedKeys: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
||||
defaultSelectedKeys: PropTypes.array,
|
||||
openKeys: PropTypes.array,
|
||||
defaultOpenKeys: PropTypes.array,
|
||||
|
|
Loading…
Reference in New Issue