ElemeFE / element

A Vue.js 2.0 UI Toolkit for Web
https://element.eleme.io/
MIT License
54.12k stars 14.64k forks source link

The El cascade component clearcheckdnodes is invalid. Multiple multiple selection is set. If it is changed to single selection, expanding the lower level selection will be invalid for the first time. You cannot choose to turn off the lower level automatically #21075

Open ezjason opened 3 years ago

ezjason commented 3 years ago

<el-cascader v-model="uploadForm.category" :options="categories" :props="{ checkStrictly: true, value: 'categoryId', label: 'categoryName', children: 'children', emitPath: false, multiple: true, }" :key="cascaderKey" :show-all-levels="false" @change="selectItem2" placeholder="请选择分类" clearable

selectItem(i) { if (i.length == 1) { this.singleItem = i[0] } if (i.length > 1) { let index = i.findIndex((v) => v === this.singleItem) i.splice(index, 1) this.form.category = '' this.$nextTick(() => { this.form.category = i this.singleItem = i[0] }) } },

设计到赋值有下级的选项可以触发bug(插入不了视频演示)

element-bot commented 3 years ago

Translation of this issue:

<el-cascader

v-model=\"uploadForm.category\" :options=\"categories\"

:props=\"{ checkStrictly: true,

value: 'categoryId', label: 'categoryName',

children: 'children', emitPath: false,

multiple: true, }\"

:key=\"cascaderKey\" :show-all-levels=\"false\"

@change=\"selectItem2\" Placeholder = \"please select category\"

clearable

selectItem(i) { if (i.length == 1) {

this.singleItem = i[0] }

if (i.length > 1) { let index = i.findIndex((v) => v === this.singleItem)

i.splice(index, 1) this.form.category = ''

this.$nextTick(() => { this.form.category = i

this.singleItem = i[0] })

} },

From design to assignment, there are lower level options that can trigger bugs (no video demo can be inserted)