I try to get into vue.js and I'm stuck.
Html page:
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="test.js"></script>
</head>
<body>
<div id="app">
<button v-on:click="exampleFunction">General</button>
</div>
</body>
</html>
test.js
var app = new Vue({
el: '#app',
data: {
message: 'Hello Vue!'
},
created: function () {
console.log('Vue instance was created');
},
methods: {
exampleFunction: function () {
console.log('This is an example function');
}
},
destroyed: function () {
console.log('Vue instance was destroyed');
}
})
app.exampleFunction();
Console output:
Vue instance was created
This is an example function
The problem is that the button does not work, it's writing nothing on the console when I click.
Any suggestion?