0👍
Why void
?
The most common way:
test: function() {
console.log('test');
}
And you call it with @click="test"
and i hope you putted everything inside methods
methods:{
test: function() {
console.log('test');
}
}
0👍
You could refer to this guide about listening to click events in vue.js. I made a sample to show how to make console.log()
work in vue.js, you could refer to it. You could also test it in Edge and it works well in my Edge 44.18362.1.0:
var example = new Vue({
el: '#example',
methods: {
test: function() {
console.log('test');
}
}
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="example">
<button @click="test">test</button>
</div>
- [Vuejs]-Laravel 6 + Vue.js Failed to mount component: template or render function not defined
- [Vuejs]-Vue Js Form post issues to server
Source:stackexchange.com