Why doesn't the ternary in vue work?

Why doesn"t my ternary work

May.12,2022

you are using it in the wrong way.

style what should be written is css code. If you put disabled in it, the css code will naturally fail if it is not legal.

if you want to use disabled , it should be:
< el-select VMI model = "value": disabled= "disabled" placeholder= "Please select

.

so you don't even need a ternary expression..


: style some styles
: css some class names


here is an object in style, and key represents the classname to be added, so you don't need the following ternary expression here, just record it with a variable isDisabled.
then use: styles= "{'disabled':isDisDisabled}"


css has no disabled


disabled is not a style


the v-bind:class attribute is recommended:

<div :class="classA ? 'aaaCLs' : 'bbbCls' ">Demo</div>
Menu