<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue 属性绑定测试实例(runoob.com)</title>
</head>
<style>
.myClass{
background: #444;
color: #eee;
}
</style>
<body>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<div id="app">
<label for="r1">修改背景和颜色</label><input type="checkbox" v-model="use" id="r1">
<br><br>
<div v-bind:class="{'myClass': use}">
v-bind:class 指令
</div>
<div v-bind:class="xx">
v-bind:class 指令
</div>
<div v-bind:class="use? xx:'ok'">
v-bind:class 指令
</div>
</div>
<script>
new Vue({
el: '#app',
data:{
use: false,
xx:"myClass"
}
});
</script>
</body>