SelectCascader
Brief Introduction
The SelectCascader component is used for users to select one or more options from a multi-level dropdown list.
You can use <MYSelect-cascader></MYSelect-cascader> or <MYSelect-cascader /> to implement a cascader selector.
Basic Usage
Use v-model to bind the selected value and pass cascading data via the options prop.
Code Demo
Please select
展开代码
Disabled State
Disable Entire Selector
Use the disabled prop to disable the selector.
Code Demo
Disabled state
展开代码
Disable a Specific Option
Use the disabled prop to disable a single option.
Code Demo
Disable a specific option
展开代码
Multi-level Menu
Multi-level menu, pass multi-level data via the options prop.
Code Demo
Multi-level menu
展开代码
Custom Size
Use the width and height props to customize the selector's width and height.
Code Demo
Custom size
展开代码
Combined Usage
Finally, here is a combination of multiple APIs to create a cascader selector:
Code Demo
Combined usage example
展开代码
API Reference
Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| modelValue | Bound value | string | array | — | — |
| options | Cascading data | Array | — | [] |
| placeholder | Placeholder text | string | — | 'Please select' |
| disabled | Whether to disable | boolean | — | false |
| width | Width | string | number | — | '260px' |
| height | Height | string | number | — | '40px' |
Type Definitions
typescript
interface OptionCascaderProps {
label: string;
value: string;
disabled?: boolean;
children?: OptionCascaderProps[];
}
interface SelectCascaderProps {
modelValue?: string | string[];
options?: OptionCascaderProps[];
placeholder?: string;
disabled?: boolean;
width?: string | number;
height?: string | number;
}