<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="app"> <!-- 綁定點擊事件 --> <!-- 寫法一 --> <button v-on:click="handlde1($event)">點擊1</button> <!-- 寫法二 --> <button @click="handlde2(123,456,$event)">點擊2</button> </div> <script src="./vue.js"></script> <script> /* 事件綁定事件-參數傳遞 1.如果事件直接綁定函數名稱,那么默認會傳遞事件對此昂作為事件函數的第一個參數 2.如果事件綁定函數調用,那么事件對象必須作為最后一個參數顯示傳遞,並且事件對 象的名稱必須是$event <button v-on:click="handlde1($event)">點擊1</button> ||相當於 <button v-on:click="handlde1">點擊1</button> */ new Vue({ el:'#app', data:{ num:0 }, methods:{ handlde2:function(p,p1,event){ console.log(p,p1); console.log(event.target.innerHTML) }, handlde1:function(event){ console.log(event.target.innerHTML) } } }) </script> </body> </html>