首页 > 代码库 > vuejs9-v-on指令

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>


本文出自 “素颜” 博客,请务必保留此出处http://suyanzhu.blog.51cto.com/8050189/1895507

vuejs9-v-on指令