<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>exercise</title> <style>
.abc{
width: 200px;
height: 200px; }
.green{
background-color: green;
}
.red{
background-color: red;
}
.blue{
background-color: blue;
}
</style>
</head>
<body>
<div id="id1"> <div>
<input type="button" class="btn1 " @click="change_color1">
</div>
<div>
<input type="button" class="btn2 " @click="change_color2">
</div>
<div>
<input type="button" class="btn3 " @click="change_color3">
</div>
<div :style="myStyle1" id="id2">box</div>
</div> </body>
<script src="vue.js"></script>
<script>
new Vue({
el:'#id1',
data:{
myStyle1: {
width: '200px',
height: '200px',
backgroundColor: 'orange'
}, },
methods:{
change_color1(){
this.myStyle1.backgroundColor = 'green'
},
change_color2(){
this.myStyle1.backgroundColor = 'red'
},
change_color3(){
this.myStyle1.backgroundColor = 'blue'
},
} })
</script>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>exercise</title> </head>
<body>
<div id="id1"> <div>
<input type="button" class="btn1 " @click="change_color1">
</div> <div :style="myStyle1" id="id2" >{{ num }}</div>
</div> </body>
<script src="vue.js"></script>
<script>
new Vue({
el:'#id1',
data:{
num:0,
color:['pink','cyan','green'],
myStyle1: {
width: '200px',
height: '200px',
backgroundColor: 'orange' }, },
methods:{
change_color1(){ this.num += 1;
color1 = this.num%3;
console.log(color1);
this.myStyle1.backgroundColor = this.color[color1];
} } })
</script>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>exercise</title> <style>
.abc{
width: 200px;
height: 200px; }
.green{
background-color: green;
}
.red{
background-color: red;
}
.blue{
background-color: blue;
}
</style>
</head>
<body>
<div id="id1"> <div>
<input type="button" class="btn1 " @click="change_color1">
</div>
<div>
<input type="button" class="btn2 " @click="change_color2">
</div>
<div>
<input type="button" class="btn3 " @click="change_color3">
</div>
<div :style="myStyle1" id="id2">box</div>
</div> </body>
<script src="vue.js"></script>
<script>
new Vue({
el:'#id1',
data:{
myStyle1: {
width: '200px',
height: '200px',
backgroundColor: 'orange'
}, },
methods:{
change_color1(){
this.myStyle1.backgroundColor = 'green'
},
change_color2(){
this.myStyle1.backgroundColor = 'red'
},
change_color3(){
this.myStyle1.backgroundColor = 'blue'
},
} })
</script>
</html>

最新文章

  1. sql筛选查询A表中B表已经存在的数据
  2. 【抓包工具】wireshark
  3. 关于Blender
  4. swiper 技巧
  5. jQuery.lazyload详解
  6. c#委托(1)
  7. XML到底是什么
  8. Visual Studio 不生成.vshost.exe和.pdb文件的方法
  9. TwoSAT算法模板
  10. [tool] google搜索的正确使用姿势(待补全)
  11. MegaCli命令使用详解
  12. Tomcat 在 Linux 上的安装和配置
  13. PHP的UTF-8中文转拼音处理类
  14. C++问题汇总
  15. ArcEngine 创建空间参考设置默认域
  16. jquery 滚动条位置的
  17. CentOS6.x 图形界面(gnome)安装
  18. codeforces水题100道 第十六题 Codeforces Round #164 (Div. 2) A. Games (brute force)
  19. 搭建基于HTTP协议内网yum仓库
  20. Hive学习之Locking

热门文章

  1. 精通CSS:高级Web标准解决方案(第二版) 初读笔记
  2. CTF—WEB—sql注入之宽字节注入
  3. python学习之面向对象(四)
  4. 小型自动化运维工具pssh和传输工具rsync
  5. 快速质因数分解及素性测试&amp;ABC142D
  6. 【神经网络与深度学习】caffe静态链接库“Unknown layer type: Convolution (known types: )”和“ 磁盘空间不足”问题的解决办法
  7. 【VS开发】ActiveX开发注意事项
  8. 【VS开发】【智能语音处理】特定人语音识别算法—DTW算法
  9. 简述Vue中使用Vuex
  10. 【洛谷p1058】立体图(已完结)