T
T
Tenebrius2018-09-13 17:15:34
Vue.js
Tenebrius, 2018-09-13 17:15:34

How can I edit component parameter values?

There is a custom range element (a wrapper for the input[type='range'] tag), with certain events its grad parameter changes. In general, this is an internal parameter that should not be accessible from the outside. It is responsible for the visual display of the set value.
VUE swears that such parameters cannot be edited directly:
vue.js:597 [Vue warn]: 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: "grad"
Example:
https://jsfiddle.net/Tenebrius/c7r8h5gf/3/
How to properly create "private" properties on a VUE v2 component?
What if the parameter is set by the parent, but it needs to be changed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-09-13
@Tenebrius

Make grad a computed property, emit instead of setting a value, and use v-model. Somehow so .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question