Commit c8226ad6 authored by baiyaaaaa's avatar baiyaaaaa

add cascader test

parent 7024daab
......@@ -425,7 +425,7 @@ Search and select options directly.
<el-cascader
placeholder="Please select"
:options="options"
show-search
filterable
></el-cascader>
<script>
module.exports = {
......@@ -478,7 +478,7 @@ Search and select options directly.
| disabled | 是否禁用 | boolean | — | false |
| allowClear | whether allow clear | boolean | — | false |
| expand-trigger | trigger mode of expandind the current item | string | click / hover | 'click' |
| showSearch | whether the options can be searched | boolean | — | — |
| filterable | whether the options can be searched | boolean | — | — |
| size | size | string | large / small / mini | — |
### Events
......
......@@ -10,16 +10,16 @@
label: 'Hangzhou',
children: [{
value: 'xihu',
label: 'West Lake',
}],
label: 'West Lake'
}]
}, {
value: 'ningbo',
label: 'NingBo',
children: [{
value: 'jiangbei',
label: 'Jiang Bei',
}],
}],
label: 'Jiang Bei'
}]
}]
}, {
value: 'jiangsu',
label: 'Jiangsu',
......@@ -28,9 +28,9 @@
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: 'Zhong Hua Men',
}],
}],
label: 'Zhong Hua Men'
}]
}]
}],
optionsWithDisabled: [{
value: 'zhejiang',
......@@ -41,16 +41,16 @@
label: 'Hangzhou',
children: [{
value: 'xihu',
label: 'West Lake',
}],
label: 'West Lake'
}]
}, {
value: 'ningbo',
label: 'NingBo',
children: [{
value: 'jiangbei',
label: 'Jiang Bei',
}],
}],
label: 'Jiang Bei'
}]
}]
}, {
value: 'jiangsu',
label: 'Jiangsu',
......@@ -59,9 +59,9 @@
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: 'Zhong Hua Men',
}],
}],
label: 'Zhong Hua Men'
}]
}]
}],
selectedOptions: [],
selectedOptions2: ['jiangsu', 'nanjing', 'zhonghuamen']
......@@ -429,7 +429,7 @@
<el-cascader
placeholder="请选择"
:options="options"
show-search
filterable
></el-cascader>
<script>
module.exports = {
......@@ -482,7 +482,7 @@
| disabled | 是否禁用 | boolean | — | false |
| allowClear | 是否支持清除 | boolean | — | false |
| expand-trigger | 次级菜单的展开方式 | string | click / hover | 'click' |
| showSearch | 是否支持搜索选项 | boolean | — | — |
| filterable | 是否支持搜索选项 | boolean | — | — |
| size | 尺寸 | string | large / small / mini | — |
### Events
......
......@@ -15,7 +15,7 @@
v-clickoutside="handleClickoutside"
>
<el-input
:readonly="!showSearch"
:readonly="!filterable"
:placeholder="displayValue ? undefined : placeholder"
v-model="inputValue"
@change="handleInputChange"
......@@ -100,7 +100,7 @@ export default {
type: String,
default: 'click'
},
showSearch: Boolean,
filterable: Boolean,
size: String
},
......@@ -111,7 +111,7 @@ export default {
menuVisible: false,
inputHover: false,
inputValue: '',
flatOptions: this.showSearch && this.flattenOptions(this.options)
flatOptions: this.filterable && this.flattenOptions(this.options)
};
},
......@@ -125,6 +125,9 @@ export default {
currentValue(value) {
this.displayValue = value.join('/');
this.dispatch('ElFormItem', 'el.form.change', [value]);
},
options(value) {
this.menu.options = value;
}
},
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment