<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="js/vue.js"></script>
<style>
.p1{
color: red;
}
.p2{
background-color: deepskyblue;
}
</style>
</head>
<body>
<div id="app">
<p :class="{p1:true,p2:false}">hello world</p>
<p :class="cls">一个文本段落</p>
<p :class=['p1','p2']>另一个文本段落</p>
<p :class="cls2">还有一个文本段落</p>
<p class="p1" :class="cls3">最后一个文本段落</p>
</div>
<script>
var vm = new Vue({
el:"#app",
data:{
cls: {p1: true, p2: true},
cls2: ["p1","p2"],
cls3: "p2"
},
methods:{
}
});
</script>
</body>
</html>