Answer the question
In order to leave comments, you need to log in
How to fix the mutation error?
gives 2:19 error Unexpected mutation of "modelValue" prop vue/no-mutating-props, i.e.
swears at this line
<template>
<select v-model="modelValue" @change="changeOption">
<option disabled value="">test</option>
<option v-for="option in options" :key="option.value" :value="option.value"> {{option.name}} </option>
</select>
</template>
<script>
export default {
name: 'my-select',
props: {
modelValue: {
type: String
},
options: {
type: Array,
default: ()=> []
}
},
methods: {
changeOption(event) {
this.$emit('update:modelValue', event.target.value);
}
}
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question