<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--Vue安装-->
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="app">
<div @click="multi()">确认{{message}}</div>
</div>
</body>
<script>
new Vue({
el: "#app",
data: {
message: 1
},
//这里是methods不是method
methods: {
multi: function () {
this.message = this.message + 1
}
}
})
</script>
</html>
Vue(五)点击事件
于 2022-05-17 16:07:21 首次发布