computed variables vue code example
Example 1: cannot access this from computed vuejs
computed:{
// Get data from vuex
$currency(){
return this.$store.state.currency
}
},
Example 2: vue computed
var vm = new Vue({
el: '#example',
data: {
message: 'Hello'
},
computed: {
// a computed getter
reversedMessage: function () {
// `this` points to the vm instance
return this.message.split('').reverse().join('')
}
}
})