zoukankan      html  css  js  c++  java
  • vue作业1

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>exercise</title>
    
        <style>
            .abc{
                 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: {
                     '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: {
                     '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{
                 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: {
                     '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>
    
  • 相关阅读:
    【WP开发】WebView控件应用要点
    【WP开发】认清“不透明度”与“可见性”的区别
    分享:自学编程的方法
    <C#>找出数组中重复次数最多的数值
    【WP 8.1开发】上下文菜单
    【WP 8.1开发】同时更新多种磁贴
    【WP开发】如何处理溢出的文本
    lnmp/nginx系统真正有效的图片防盗链完整设置详解
    PHP自动加载SPL的四种处理方式
    算法笔记-判断链表保存的字符串是否是回文
  • 原文地址:https://www.cnblogs.com/ghylpb/p/12052054.html
Copyright © 2011-2022 走看看