<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title></title>

</head>

<body>

<div id="app">

        <p><input type="text" v-model="message"></p>

        <p>

            <button @click="greet">Greet</button>

        </p>

        <p>

            <button @click="say('Hi')">Hi</button>

        </p>

    </div>

<script src="http://static.runoob.com/assets/vue/1.0.11/vue.min.js"></script>

<script>

var vm = new Vue({

el:"#app",

data:{

message:'Hello,Vue.js!'

},

methods:{

greet:function(){

alert(this.message);

},

say:function(msg){

alert(msg);

}

}

});

</script>

</body>

</html>

注意:v-on指令可以缩写为@符号

vuejs9-v-on指令简写形式_简写形式