vuejs9-v-on指令

<!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 v-on:click="greet">Greet</button>

        </p>

        <p>

            <button v-on: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>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章