Talking about how to bind variable values of vue to prevent changes, and talking about vue
1. Object. freeze (obj) Statement
Obj = {foo: "nan"} Object. freeze (obj );
After the variable is fixed with this statement, changes to this variable will be invalid and an error will be reported in the console.
2. Bind the v-once Element
<Span >{{ msg }}</span>
After the msg data changes, the span content also changes immediately.
<Span v-once >{{ msg }}</span>
If the v-once binding is added, even if the msg in the data changes the content in the span, it will not change. However, this does not prevent data changes, but is only bound with an html element so that it cannot be changed.
The above discussion about the value of several vue binding variables to prevent the change is to share all the content with you in small series. I hope to give you a reference, and I hope you can also support the help house.