vue2 Problems encountered by novices developing small demos:
-
{{food.count}}
+
Vue.set(this.food, 'count', 1) dynamically adds attributes, butis not displayed. What is the reason? How should we solve it?
Vue.set( object, key, value )
props should be immutable.
The data state is variable.
And Vue.set dynamically sets the properties of the object, and this object should also exist in data.