<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <!-- 数据渲染界面 --> <div id="abc"> {{count}} <button v-on:click="count=count+10">按钮1</button> <button v-on:click="fn2()">按钮2</button> <button v-on:click="fn2()">按钮3</button> <button @click="fn5(1000)">按钮4</button> <button @click="fn5(1000)">按钮5</button> <!-- 当前的事物对象 --> <button @click="fn6($event)">按钮6</button> </div> <script src="./js/vue.js"></script> <script> var vm = new Vue({ //v-on里面的methods方法 el: '#abc', //模板ajax返回的数据 data: { msg: '我是歌谣', count: 10 }, methods: { fn2: function() { console.log('fn.....') }, fn5: function(x) { console.log(x); }, fn6(e) { console.log(e); } } }) </script> </body> </html>