Reputation: 2197
I have data in vue component which changes based on the select dropdown values. I want to change my other data in the same component based on these changes.
for example
data: function()
{
return{
page:'self-employed', //dynamic data bind with select element
loan:this.page === 'self-employed' ? 'business-loan' : 'personal-loan',
}
}
i use conditional statement but it is not working at all.
Upvotes: 0
Views: 40
Reputation: 1
loan
should be a computed property based on your other data :
data: function() {
return {
page: 'self-employed', //dynamic data bind with select element
}
},
computed: {
loan() {
return this.page === 'self-employed' ? 'business-loan' : 'personal-loan'
}
}
Upvotes: 2