homeworkvue

两个半圆,点一下转90°,两个颜色

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .wrap {
            border:3px solid black;
             200px;
            height: 200px;
            border-radius: 50%;
            overflow: hidden;
            margin: 50px auto 0;
            position: relative;
            background-color: green;
        }
        .red {
             100px;
            height: 200px;
            position: absolute;
            background-color: red;
        }
        .l {
             100px;
            height: 200px;
            left: 0;
        }
        .t {
             200px;
            height: 100px;
            top: 0;
        }
        .r {
             100px;
            height: 200px;
            right: 0;
        }
        .b {
             200px;
            height: 100px;
            bottom: 0;
        }
    </style>
</head>
<body>
<div id="app">
    <div class="wrap" @click="change" >
        <div class="red" :class="red_class" ></div>
   </div>
</div>
</body>
<script src="js/vue.js"></script>
<script>
    new Vue ({
        el:"#app",
        data : {
            count : 0 ,
            red_class:'l',
            red_arr :['l','t','r','b']
    },
        methods:{
            change(){
                this.count ++;
                this.red_class=this.red_arr[this.count %4]
            }
        },
    })
</script>
</html>
原文地址:https://www.cnblogs.com/agsol/p/12055608.html