[Vuejs]-Vue: My initial data value is not accessible when used as a function param

0👍

Is you button in the <template> tags?

If so, you do not need to use this delete from the click argument and v-if. However that should only throw a warning.

Can you also post the code for the method addToCart?

If you are not setting the full discountProduct object you will need to make sure setting the id is reactive. Like the example below:

this.$set(this.discountProduct, 'id', 1)

Nested Object/keys are not reactive without using $set. See https://v2.vuejs.org/v2/guide/reactivity.html for more details.

Hope this helps

Leave a comment