<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div id="app"> <input type="button" value="一个按钮" v-on:click="show()"><br> <input type="button" value="一个按钮" @click="show()"> </div> <script src="js/vue.js"></script> <script> //1. 创建Vue核心对象 new Vue({ el:"#app", data(){ return{ username:"", url:"http://www.baidu.com" } }, methods:{ show(){ alert("我被点了。。。。") } } }); </script> </body> </html>
标签:username,el,www,Vue,return,指令 From: https://www.cnblogs.com/Karl-hut/p/17523988.html