Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How use Vue.set() in NuxtJs application?

I want to set a property, by using Vue.set() in Nuxtjs application.

editPost(post) {
    Vue.$set(post, 'edit', true)
}

Got error: Vue is not defined

like image 912
Ilya Vo Avatar asked Dec 23 '22 02:12

Ilya Vo


1 Answers

You can just use this instead of Vue.. This references the current vue component inside the method, so it will work same way:

editPost(post) {
    this.$set(post, 'edit', true)
}
like image 195
Aldarund Avatar answered Jan 06 '23 10:01

Aldarund