Can I disable specific Vue alerts for a specific component?

I have a (parent) component in Vue that provides it with its own on-screen keyboard, which has its own Vue component. The keyboard tracks the entered value and passes that value to the parent component. Sometimes the parent component needs to reset the value.

The way it is currently implemented is to directly change the alert sent to the keyboard. This clearly gives a warning Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders.. However, this is exactly the behavior that I expect in this case: the variables are in sync and should remain in sync if the parent parameter changes the value. In other words: I want to disable this specific warning for this particular component.

I could add an observer to a property that overwrites the local variable and uses the local variable instead to keep track of everything. This is ... stupid because it does exactly what it is doing now, with lots of variables to keep track of. However, I have not yet found a way to warn the warnings. Is there such a feature?

+4
source share

Source: https://habr.com/ru/post/1676987/


All Articles