• day 65 作业


    1

    <script src="vue/vue.js"></script>
    
    <div id="app">
        <form action="" style="margin: 20px;">
            <p @click="tag" :style="{ w,height: h, backgroundColor: bgc}"></p>
            <input type="button" value="红" @click="tag($event,'red')">
            <input type="button" value="黄" @click="tag($event,'yellow')">
            <input type="button" value="绿" @click="tag($event,'green')">
        </form>
    </div>
    
    <script>
        new Vue({
            el:'#app',
            data:{
                h: '200px',
                w: '200px',
                bgc: 'red'
                },
            methods:{
                tag (a,b) {
                    this.bgc = b
                }
            }
        })
    </script>
    

    2

    <div id="app">
        <form action="" style="margin: 20px;">
            <p @click="tag" :style="{ w,height: h, backgroundColor: bgc}"></p>
        </form>
    </div>
    
    <script>
        let num = 0;
        new Vue({
            el:'#app',
            data:{
                h: '200px',
                w: '200px',
                bgc: 'red'
                },
            methods:{
                tag () {
                    num += 1;
                    if (num==1){
                        this.bgc = 'pink'
                    }else {if (num==2){
                        this.bgc = 'green'
                    }else {
                        this.bgc = 'cyan';
                        num = 0
                    }}
                }
            }
        })
    </script>
    

    3

    <div id="app">
        <form action="" style="margin: 20px;">
            <p @click="tag" :style="{ w,height: h, background: bgc, borderRadius:rad}"></p>
        </form>
    </div>
    
    <script>
        let num = 0;
        let app = new Vue({
            el:'#app',
            data:{
                h: '200px',
                w: '200px',
                bgc: 'linear-gradient(to top, red 50%, green 50%)',
                rad: '50%'
                },
            methods:{
                tag () {
                    num += 1;
                    if (num==1){
                        this.bgc = 'linear-gradient(to top, red 50%, green 50%)'
                    }else {if (num==2){
                        this.bgc = 'linear-gradient(to left, red 50%, green 50%)'
                    }else {if (num==3) {
                        this.bgc = 'linear-gradient(to bottom,red  50%, green 50%)'
                    }else {
                        this.bgc = 'linear-gradient(to right, red 50%, green 50%)';
                        num = 0
                    }
                    }}
                }
            }
        });
        function funcTest(){
        window.setInterval(app.tag,500);
    }
        window.onload = funcTest;
    </script>
    
  • 相关阅读:
    FreeSWITCH第三方库(视频)的简单介绍(二)
    FreeSWITCH第三方库(音频)的简单介绍(一)
    libreoffice实现WORD文档转PDF文档
    Linux TOP命令详解
    java内存泄漏
    FreeSWITCH的传真发送
    CPU的一些参数和排名
    设计模式(九)访问者模式
    设计模式(八)状态模式
    使用PermissionsDispatcher轻松解决Android权限问题
  • 原文地址:https://www.cnblogs.com/luocongyu/p/12050933.html
Copyright © 2020-2023  润新知