VUE框架v-if
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="vue3.js"></script>
<style>
.c1{
color: red;
}
.c2{
}
</style>
</head>
<body>
<div id="app">
<h3>展示电影</h3>
<div v-if="age>18">成年电影</div>
<div v-else>青少年电影</div>
<h3>展示成绩</h3>
<div v-if="score>90">优秀</div>
<div v-else-if="score>80">良好</div>
<div v-else-if="score>60">及格</div>
<div v-else>不及格</div>
</div>
<script>
// 数据驱动界面
var vm = Vue.createApp({
data(){
return {
age: 12,
score: 79,
}
},
}).mount("#app")
</script>
</body>
</html>
![](https://img2022.cnblogs.com/blog/1413093/202206/1413093-20220610205354311-680596299.png)