vuejs computed with parameter code example
Example 1: cannot access this from computed vuejs
computed:{
// Get data from vuex
$currency(){
return this.$store.state.currency
}
},
Example 2: computed vue js
var vm = new Vue({
el: '#demo',
data: {
firstName: 'Foo',
lastName: 'Bar',
fullName: 'Foo Bar'
},
watch: {
firstName: function (val) {
this.fullName = val + ' ' + this.lastName
},
lastName: function (val) {
this.fullName = this.firstName + ' ' + val
}
}
})