there are child components in parentheses. I click the button to pass true to the parent component to change its state, but the error says: avoid changing a PROP, directly because the value is overwritten every time the parent component is re-rendered.
export default{
props: {
onlyContent: {
type: Boolean,
default: false
}
},
methods: {
toggleContent (event) {
if (!event._constructed) {
return
}
this.onlyContent = !this.onlyContent
this.$emit("contentToggle", this.onlyContent)
}
}
}
<v-ratingSelect v-on:contentToggle="contToggle" :only-content="onlyContent"></v-ratingSelect>
data () {
return {
onlyContent: false
}
}
contToggle (event) {
this.onlyContent = event
}