image.png

代码

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue.js中v-else-if指令</title>
    <script src="//static.gzj2001.com/vue/vue.js"></script>
</head>
<body>
    <div id="app">
<div v-if=" type === 1">1
</div>
<div v-else-if=" type === 2">2
</div>
<div v-else-if=" type ===3 ">3
</div>
<div v-else>
not 1/2/3    
</div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                type:5
            }
        })
    </script>
</body>
</html>