vue if else用法。

版权声明:独学而无友,则孤陋寡闻。q群582951247 https://blog.csdn.net/mp624183768/article/details/87898387

html

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<div id="app">
  <h2>学习成绩</h2>
  <input type="text" v-model="score">
  <div v-if="score>=60">很棒 你及格了 </div>
  <div v-else> 不及格</div>
  <div>当前时间:{{date}}</div>
</div>
 
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
</body>
</html>

js

var app=new Vue({
el:'#app',
data:{
message:'aaa',
  score:'0',
  date:'页面加载于 '+new Date().toLocaleString()
}
});

猜你喜欢

转载自blog.csdn.net/mp624183768/article/details/87898387