javascript - vue.js assignments are all two-way binding. How to only assign values ​​but not two-way binding?
三叔
三叔 2017-06-15 09:21:41
0
3
938

The data in vue is two-way bound.
But I don’t want to bind, I just want to assign the value to vue, but the original attributes remain unchanged, that is, one-way assignment?

var v = new Vue({el: "#a",data:{ a: ''}

})

开始 a = '';
var b = 2;
v.a = b;

v.a = 3; // 这里b也等于3了

我想
v.a =3; // 但是b还是等于2

What method is used to assign values?

三叔
三叔

reply all(3)
淡淡烟草味

Two-way binding only works in templates

漂亮男人

b will not also be equal to 3

Ty80

Put the code on codepen and reproduce it?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!