I am new to Vue.js and I am trying to figure out how to call a method from a component.
var app = new Vue({
el: '#app',
components: {
message: {
props: ['createdat'],
template: '
<div>
{{ postedOnA(createdat) }}
{{ postedOnB(createdat) }}
</div>',
},
methods: {
postedOnA: function (createdat) {
var date = new Date(createdat);
return date.getHours() + ' ' + date.getMinutes();
}
}
},
methods: {
postedOnB: function(createdat) {
var date = new Date(createdat);
return date.getHours() + ' ' + date.getMinutes();
}
}
})
Even after attempting to call the component method, it is still not working as expected.
Any help would be greatly appreciated. Thank you!