| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <!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>
- .colors {
- color: red;
- }
- .aa {
- font-style: italic;
- }
- </style>
- </head>
- <body>
- <div id="app">
- <!--
- 内置指令:
- v-bind => :
- v-bind:class / :class
- -->
- <!-- 对象 -->
- <h1 v-bind:class="{colors:isShow}">{{msg}}</h1>
- <!-- 数组 -->
- <h1 v-bind:class="['colors','aa']">哈哈哈哈</h1>
- <!-- 数组 + 对象 -->
- <h1 :class="['colors',{aa: isShow}]">嘿嘿</h1>
- </div>
- <script src="./vue.js"></script>
- <!--
- -->
- <script>
- var app = new Vue({
- el:"#app",
- data:{
- msg:"你好啊",
- isShow: true
- }
- })
- </script>
- </body>
- </html>
|