I am working with a Vue component and a vue element declaration. Here is the code snippet:
Vue.component('todo-item', {
template: '<li>This is a todo</li>',
methods: {
test: function() {
// There seems to be an error here
app.aNewFunction();
}
}
})
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
},
methods: {
aNewFunction: function() {
alert("inside");
}
}
})
Can someone guide me on how to call a method in the Vue app from the Vue component?