I use the library element.io and i would like to change "disabled" prop to true on an input when a select has the value "a".
Select :
<el-select v-model="selected_devise" slot="append" placeholder="Devise">
<el-option
v-for="item in devises"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
Values of the select :
devises: [
{
label: 'a',
value: 'a',
},
{
label: 'b',
value: 'b',
},
{
label: 'c',
value: 'c',
}]
When i select 'b' i want to set my input to disabled, and for this i have to edit props :
<el-input type="text" ref="montant" v-model="montant" placeholder="Saisissez le montant"></el-input>
When i try with this.$refs.montant.$props.disabled = true; i get :
Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "disabled"
Thanks for your help
this.$emit
to emit a custom event in the child component and have the parent listen for the event and mutate the prop. Please refer to this – Husam Ibrahim