[Vuejs]-Obj.hasOwnProperty always returns false even after property created

1👍

Vue (2, anyway) cannot detect property addition or removal.

You should declare the test property within stocks, so that it’s there from the beginning:

stocks : [
    {'name' : 'Tesla', 'price' : 800, test: false },
    {'name' : 'Microsoft', 'price' : 300, test: false },
]

Then it’ll be reactive and you can show/hide your element based on the value of test.

Leave a comment