Set Computed property in vuejs - Computed Property with setter - Vuejs tutorial - Tutorial 12

preview_player
Показать описание

Set Computed properties in vuejs - Computed Property with setter - In this lecture we will learn how you can set computed property. By default computed properties are getter only. So, how can we set computed property. Sometime in our app we need computed property but we also need to set value on changes. So, In this lecture I will show you how to set computed property in vuejs.

First we will start with simple example which will have computed property which is only getter not setter. In html we will have input which will have computed property binded to it. Now, when we change that input field it gives error in console saying getter do not have setter.

So, In this example I will show you how you can bind computed property using v-model and set computed property according to v-model changes.

Follow me:
Рекомендации по теме
Комментарии
Автор

who is assigning newValue to set() v-model="name" ? I don't understand there should be any relation with v-model and computed property name. I mean any v-model == computed in such ase set() of computed get value of v-model Is it correct ?

PrashantNirgun
Автор

Dear when I am trying to remove complete content, it doesn't allow once we reach at space position. To do so I need to move cursor manually by shift left button...
Got the answer as we mentioned in the logic that's why its happening.

hum_bhi_shayar
visit shbcf.ru