0
点赞
收藏
分享

微信扫一扫

【Vue】利用Vue绑定Html元素事件(如:click)综合示例


一、绑定按钮单机事件

【Vue】利用Vue绑定Html元素事件(如:click)综合示例_html


<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<script src="js/vue/vue.js"></script>

<body>
<div id="root">
<button v-on:click="showInfo"> 点击我提示信息</button>
</div>

</body>

<script type="text/javascript">


var root = new Vue({
el: "#root",
data: {
name: "中国人"
},
methods: {
showInfo() {
alert("我是中国人");
}
}
})

</script>
</html>


举报

相关推荐

0 条评论