mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-01 02:37:46 +08:00
docs: [el-cascader] add guidance on how to set props (#4689)
This commit is contained in:
parent
6113e9e539
commit
d6d74c510a
@ -49,7 +49,36 @@ cascader/last-level
|
||||
|
||||
## Multiple Selection
|
||||
|
||||
Set `props.multiple = true` to use multiple selection.
|
||||
Add `:props="props"` in tag and set data `props = { multiple: true }` to use multiple selection.
|
||||
|
||||
Do:
|
||||
|
||||
```html
|
||||
<template>
|
||||
<el-cascader :props="props" />
|
||||
</template>
|
||||
<script lang="ts">
|
||||
export default {
|
||||
setup() {
|
||||
return {
|
||||
props: {
|
||||
// props.
|
||||
multiple: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
```
|
||||
|
||||
Don't do:
|
||||
|
||||
```html
|
||||
<template>
|
||||
<!-- Object literal binging here is invalid syntax for cascader -->
|
||||
<el-cascader :props="{ multiple: true }" />
|
||||
</template>
|
||||
```
|
||||
|
||||
:::demo When using multiple selection, all selected tags will display by default, You can set `collapse-tags = true` to fold selected tags.
|
||||
|
||||
|
@ -3,21 +3,13 @@
|
||||
<span class="demonstration"
|
||||
>Select any level of options (Single selection)</span
|
||||
>
|
||||
<el-cascader
|
||||
:options="options"
|
||||
:props="{ checkStrictly: true }"
|
||||
clearable
|
||||
/>
|
||||
<el-cascader :options="options" :props="props1" clearable />
|
||||
</div>
|
||||
<div class="block">
|
||||
<span class="demonstration"
|
||||
>Select any level of options (Multiple selection)</span
|
||||
>
|
||||
<el-cascader
|
||||
:options="options"
|
||||
:props="{ multiple: true, checkStrictly: true }"
|
||||
clearable
|
||||
/>
|
||||
<el-cascader :options="options" :props="props2" clearable />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -27,6 +19,13 @@ import { defineComponent, reactive, toRefs } from 'vue'
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const state = reactive({
|
||||
props1: {
|
||||
checkStrictly: true,
|
||||
},
|
||||
props2: {
|
||||
multiple: true,
|
||||
checkStrictly: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
value: 'guide',
|
||||
|
@ -14,7 +14,7 @@
|
||||
<el-cascader
|
||||
v-model="value"
|
||||
:options="options"
|
||||
:props="{ expandTrigger: 'hover' }"
|
||||
:props="props"
|
||||
@change="handleChange"
|
||||
></el-cascader>
|
||||
</div>
|
||||
@ -27,6 +27,9 @@ export default defineComponent({
|
||||
setup() {
|
||||
const state = reactive({
|
||||
value: [],
|
||||
props: {
|
||||
expandTrigger: 'hover',
|
||||
},
|
||||
options: [
|
||||
{
|
||||
value: 'guide',
|
||||
|
@ -12,7 +12,7 @@
|
||||
<el-cascader
|
||||
placeholder="Try searchingL Guide"
|
||||
:options="options"
|
||||
:props="{ multiple: true }"
|
||||
:props="props"
|
||||
filterable
|
||||
/>
|
||||
</div>
|
||||
@ -24,6 +24,9 @@ import { defineComponent, reactive, toRefs } from 'vue'
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const state = reactive({
|
||||
props: {
|
||||
multiple: true,
|
||||
},
|
||||
options: [
|
||||
{
|
||||
value: 'guide',
|
||||
|
Loading…
Reference in New Issue
Block a user