12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <!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>
- .happy {
- width: 300px;
- height: 200px;
- background-color: red;
- margin: 100px auto;
- }
- .word {
- color: #ff0;
- font-size: 36px;
- font-weight: 600;
- }
- </style>
- </head>
- <body>
- <!--
- 样式绑定内置指令:
- class 和 style
- 1.v-bind:class="样式"
- 2.:class="样式"
- -->
- <div id="app">
- <!-- 对象 -->
- <!-- <div :class="{happy:isShow,word:isShow}">你好</div> -->
- <!-- <div v-bind:class="{happy:isShow}"></div> -->
- <!-- <div v-bind:class="{happy:true}"></div> -->
- <!-- 数组 -->
- <!-- <div :class="['happy','word']">你好</div> -->
- <!-- <div v-bind:class="['happy','word']">你好</div> -->
- <!-- 数组 + 对象 -->
- <div :class="['happy',{word:true}]">哈哈哈哈</div>
- </div>
- <script src="./vue.js"></script>
- <script>
- var app = new Vue({
- el: "#app",
- data: {
- isShow: true,
- },
- });
- </script>
- </body>
- </html>
|