Bug Type: Component
Environment
- Vue Version:
3.2.37
- Element Plus Version:
2.2.33
- Browser / OS:
chrome 110.0.5481.105 / window 11
- Build Tool:
Vite
Reproduction
Related Component
el-cascader
Reproduction Link
Steps to reproduce
<template>
<el-cascader
v-model="state.cascaderData"
:options="options"
:show-all-levels="false"
:props="{
checkStrictly: true,
}"
/>
</template>
<script setup lang="ts">
import { reactive } from "vue";
interface State {
cascaderData: string[];
}
const state: State = reactive({
cascaderData: [],
});
const options = [
{
value: "guide",
label: "Guide",
disabled: true,
children: [
{
disabled: true,
value: "disciplines",
label: "Disciplines",
children: [
{
value: "consistency",
label: "Consistency",
},
{
value: "feedback",
label: "Feedback",
},
{
value: "efficiency",
label: "Efficiency",
},
{
value: "controllability",
label: "Controllability",
},
],
},
{
value: "navigation",
label: "Navigation",
disabled: true,
children: [
{
value: "side nav",
label: "Side Navigation",
},
{
value: "top nav",
label: "Top Navigation",
},
],
},
],
},
];
</script>
What is Expected?
Option is disabled and cannot be selected
What is actually happening?
radio is disabled, but click text be selected
3条答案
按热度按时间gj3fmq9x1#
Set
props.checkStrictly = true
to make checked state of a node not affects its parent nodes and child nodes, and then you can select any level of options.Remove
checkStrictly: true
or setcheckStrictly: false
may meet expectations.https://element-plus.org/en-US/component/cascader.html#select-any-level-of-options
playground
ymdaylpp2#
I want to set the default data, then select Level 3 option and disable Level 1 and Level 2 option,If I set the attribute, I will not be able to select any option. I think it is bug and not a feature.
like this playground
Set
props.checkStrictly = true
to make checked state of a node not affects its parent nodes and child nodes, and then you can select any level of options.Remove
checkStrictly: true
or setcheckStrictly: false
may meet expectations.https://element-plus.org/en-US/component/cascader.html#select-any-level-of-options
playground
ct2axkht3#
@zhuyue6 I think it might be reasonable. The user has full control over the value.
You are free to modify the value.
Like
Select
disabled status.Select disbaled (element-plus playground)
Select disbaled (AntD react) codesandbox
Select disbaled (MUI react) codesandbox