I have a vue component and a vue element declaration as given below
Vue.component(\'todo-item\', {
template: \'This is a todo \'
methods:
You can execute root instance method like this: this.$root.methodName()
Vue.component('todo-item', {
template: '- This is a todo
',
methods: {
test: function() {
this.$root.aNewFunction();
}
},
mounted() {
this.test();
}
})
new Vue({
el: '#app',
template: ' ',
methods: {
aNewFunction: function() {
alert("inside");
}
}
})