zoukankan      html  css  js  c++  java
  • day65 作业

    作业1

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    <div id="app">
         <p :style="myStyle"></p>
         <button @click="f1">红</button>
         <button @click="f2">黄</button>
         <button @click="f3">蓝</button>
    </div>
    </body>
    <script src="js/vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data:{
                myStyle:{
                    '200px',
                    height:'200px',
                    backgroundColor:'black'
                }
            },
            methods:{
                f1(){
                    this.myStyle.backgroundColor='red'
                },
                f2(){
                    this.myStyle.backgroundColor='yellow'
                },
                f3(){
                    this.myStyle.backgroundColor='blue'
                }
            }
        })
    </script>
    </html>
    

    作业2

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    <div id="app">
             <p :style="myStyle" @click="f1"></p>
    </div>
    
    </body>
    <script src="js/vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data:{
                num:0,
                myStyle:{
                    '200px',
                    height:'200px',
                    backgroundColor:'black'
                }
            },
            methods:{
                f1(){
                    this.num+=1
                    if (this.num%3==1){
                        this.myStyle.backgroundColor='pink'
                    }else if(this.num%3==2){
                        this.myStyle.backgroundColor='green'
                    }else{
                        this.myStyle.backgroundColor='cyan'
                    }
                }
            }
    
        })
    </script>
    </html>
    

    作业3

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    
    
    
    
    </head>
    <body>
    <div id="app">
        <div :style="myStyle2" @click="f1">
          <div :style="myStyle" ></div>
          <div :style="myStyle1"></div>
        </div>
    </div>
    </body>
    <script src="js/vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data:{
                num:0,
                myStyle:{
                    '50px',
                    height:'100px',
                    backgroundColor:'red',
                    borderRadius:'50px 0 0 50px',
                    float:'left'
                },
                myStyle1:{
                    '50px',
                    height:'100px',
                    backgroundColor:'yellow',
                    borderRadius:'0 50px 50px 0',
                    float:'left'
                },
                myStyle2:{
                    position:'fixed',
                },
    
            },
            methods:{
                f1(){
                   this.num+=1
                    if (this.num%4==1){
                       this.myStyle.width='100px';
                       this.myStyle1.width='100px';
                       this.myStyle.height='50px';
                       this.myStyle1.height='50px';
                       this.myStyle.borderRadius='50px 50px 0 0';
                       this.myStyle1.borderRadius='0 0 50px 50px'
                        this.myStyle.float='none'
                        this.myStyle1.float='none'
                    }else if (this.num%4==2){
                       this.myStyle.width='50px';
                       this.myStyle1.width='50px';
                       this.myStyle.height='100px';
                       this.myStyle1.height='100px';
                       this.myStyle.borderRadius='50px 0 0 50px';
                       this.myStyle1.borderRadius='0 50px 50px 0'
                        this.myStyle.float='left'
                        this.myStyle1.float='left'
                        this.myStyle.backgroundColor='yellow'
                        this.myStyle1.backgroundColor='red'
                    }else if (this.num%4==3){
                        this.myStyle.width='100px';
                       this.myStyle1.width='100px';
                       this.myStyle.height='50px';
                       this.myStyle1.height='50px';
                       this.myStyle.borderRadius='50px 50px 0 0';
                       this.myStyle1.borderRadius='0 0 50px 50px'
                        this.myStyle.float='none'
                        this.myStyle1.float='none'
                        this.myStyle.backgroundColor='yellow'
                        this.myStyle1.backgroundColor='red'
                    }else{
                       this.myStyle.width='50px';
                       this.myStyle1.width='50px';
                       this.myStyle.height='100px';
                       this.myStyle1.height='100px';
                       this.myStyle.borderRadius='50px 0 0 50px';
                       this.myStyle1.borderRadius='0 50px 50px 0'
                        this.myStyle.float='left'
                        this.myStyle1.float='left'
                        this.myStyle.backgroundColor='red'
                        this.myStyle1.backgroundColor='yellow'
                    }
    
            }
        }
        })
    </script>
    </html>
    
  • 相关阅读:
    使用Vue初始化项目的时候,一直download template的解决方案
    移动端复选框和单选框选中样式不能正常显示
    PC端360浏览器如何打开手机模式
    我在项目中是这样配置Vue的
    怎么取消微信pc端“保持微信窗口在最前面”设置?
    5个 Vuex 插件,给你的下个VueJS项目
    Vue+Element前端导入导出Excel
    前端快来!最火的 Vue.js 开源项目出炉
    1月12日学习日志
    1月9日学习日志
  • 原文地址:https://www.cnblogs.com/zqfzqf/p/12052025.html
Copyright © 2011-2022 走看看