vue.js实战——$event
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>$event</title> <script src="./vue.js"></script> </head> <body> <div id="app"> <a href="http://www.apple.com" @click="handleClick('禁止打开',$event)">打开链接</a> </div> <script> var app=new Vue({ el:'#app', methods:{ handleClick:function(message,event){ event.preventDefault(); window.alert(message); } } }) </script> </body> </html>