vuejs / Discussion

Vue.js discussion
167 stars 17 forks source link

How to prevent from binding two variables #152

Open Anshul-Batra opened 9 years ago

Anshul-Batra commented 9 years ago

I am writing the following code:


Obj.$add('testvar', jsvar);

where Obj is vue object and i am assigning value of jsvar to the data var of vue object..

My problem is that testvar is getting bind to jsvar...whenever the value of testvar changes the value of jsvar also changes...hoe do i prevent it to bind to each other..I just want to assign the value i don't want to bind.

yyx990803 commented 9 years ago

You can make a deep clone of jsvar before adding it.