<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>事件处理</title>
</head>
<body>
<div id="app">
<button v-on:click="changeLength(1)">边长加1</button>
<button v-on:click="changeLength(10)">边长加10</button>
<p>正方形的边长是{{length}},面积是{{area}}</p>
</div>
<script src="../js/vue.js"></script>
<script>
let square = {
length:2
};
let vm = new Vue({
el:'#app',
data:square,
methods:{
changeLength(delta) {
this.length += delta;
}
},
computed:{
area(){
return this.length * this.length;
}
}
});
</script>
</body>
</html>
vue-前端第5章event03.html
原创
©著作权归作者所有:来自51CTO博客作者虾米大王的原创作品,请联系作者获取转载授权,否则将追究法律责任

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
vue-前端第5章event12.html
【代码】vue-前端第5章event12.html。
javascript css html bc -
vue-前端第5章event04.html
【代码】vue-前端第5章event04.html。
vue.js javascript 前端 html Vue -
vue-前端第5章event01.html
【代码】vue-前端第5章event01.html。
vue.js javascript 前端 html Vue -
vue-前端第5章event11.html
【代码】vue-前端第5章event11.html。
javascript html css 修饰符 -
vue-前端第5章event14.html
【代码】vue-前端第5章event14.html。
vue.js javascript 前端 html Vue -
vue-前端第5章event06.html
【代码】vue-前端第5章event06.html。
javascript vue.js 前端 html css -
vue-前端第5章event02.html
【代码】vue-前端第5章event02.html。
vue.js javascript 前端 html Vue -
vue-前端第5章event05.html
【代码】vue-前端第5章event05.html。
vue.js javascript 前端 html Vue -
vue-前端第5章event10.html
【代码】vue-前端第5章event10.html。
javascript css html 修饰符 -
vue-前端第5章event09.html
【代码】vue-前端第5章event09.html。
javascript html css 修饰符 -
vue-前端第5章event13.html
【代码】vue-前端第5章event13.html。
javascript css html 修饰符 提交表单 -
vue-前端第5章event08.html
【代码】vue-前端第5章event08.html。
javascript css html 修饰符 -
vue-前端第5章event07.html
【代码】vue-前端第5章event07.html。
javascript html css bc -
vue-前端第5章event00.html
【代码】vue-前端第5章event00.html。
javascript 前端 java html 事件流 -
vue-前端第6章form03.html
【代码】vue-前端第6章form03.html。
vue.js javascript 前端 html Vue -
vue-前端第4章class03.html
【代码】vue-前端第4章class03.html。
javascript vue.js css html -
vue-前端第8章demo03.html
【代码】vue-前端第8章demo03.html。
javascript 前端 html vue.js Vue -
vue-前端第8章demoTwo03.html
【代码】vue-前端第8章demoTwo03.html。
vue.js javascript java sed html -
vue-前端第12章transition03.html
【代码】vue-前端第12章transition03.html。
vue.js html 开发技术 css