3👍
✅
Solution
new Vue({
el:'#app',
methods: {
nextPage: function() {
console.log('you have clicked me')
}
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<html>
<body>
<div id="app">
<button v-on:click="nextPage">Click ME</button>
<div class='key'> c </div>
</div>
</body>
</html>
Never mount Vue
to the html
or body
tags as you can see in my example I created a new div
and gave it the app
id then wrapped it around all the page contents.
Source:stackexchange.com