这块儿的关于三元表达式后面再根据需要,再进行补习。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="vue.js"></script>
<style>
.red{color:red;}
.thin{font-weight:200;}
.italic{font-style: italic;}
.active{letter-spacing: 0.5em;}
</style>
</head>
<body>
<div id="app">
<h1 :class="['red','thin']">这是邪恶的H1</h1>
<h1 :class="['red','thin',iscative?'active':'']">这是邪恶的H1</h1>
<h1 :class="['red','thin',{'active':iscative}]">这是邪恶的H1</h1>
<h1 :class="{red:ture,iscative:true,thin:ture}">这是邪恶的H1</h1>
</div>
<script>
var vm =new Vue({
el:'#app',
data:{
},
methods:{
}
})
</script>
</body>
</html>