<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
</style>
</head>
<body>
<div id="app">
<div v-if='score>=90'>优秀</div>
<div v-else-if='score<=90&&score>=80'>良好</div>
<div v-else-if='score<=80&&score>=60'>一般</div>
<div v-else='score<=80&&score>=60'>差</div>
<div v-show='flag'>测试v-show</div>
<button v-on:click='handle'>显示</button>
</div>
<script type="text/javascript" src="./js/vue.js"></script>
<script>
var vm = new Vue({
//绑定的标签
el: '#app',
//自定义按键修饰符
data: {
score: 69,
flag: false
},
methods: {
//控制元素样式是否显示
handle: function() {
this.flag = !this.flag;
}
}
});
</script>
</body>
</html>