-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path4.class-binding.html
More file actions
33 lines (32 loc) · 817 Bytes
/
Copy path4.class-binding.html
File metadata and controls
33 lines (32 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- development version, includes helpful console warnings -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
.active{
color: green;
}
.notActive{
color: red;
}
</style>
</head>
<body>
<div id="app">
<h3 v-bind:class="{active : isActive}">This is a sample text</h3>
<h3 v-bind:class="[isActive ? 'active' : 'notActive']">This is a sample text</h3>
</div>
</body>
<script type="text/javascript">
var app = new Vue({
el: '#app',
data: {
isActive : true,
}
});
</script>
</html>