分支v-if

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .active {
            border:1px solid red;
            width:100px;
            height:100px;
        }
        .error {
            background-color: orange;
        }
    </style>
</head>
<body>
    <div id = "app1">
        <div v-if='score>=90'>优秀</div>
        <div v-else-if='score<90&&score>=80'>良好</div>
        <div v-else-if='score<80&&score>=70'>一般</div>
        <div v-else='score<70'></div>
    </div>
    <script src="vue.js"></script>
    <script>
        var vue1 = new Vue({
            el: '#app1',
            data:{
                score:88
            },
            methods:{
                
            }
        })
    </script>
</body>
</html>

 

posted on 2020-08-01 18:39  知否知否,  阅读(116)  评论(0编辑  收藏  举报