Vue

스타일 바인딩

땀모 2020. 2. 15. 22:57



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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.2/dist/vue.js"></script>
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div :style="{ color: red, fontSize: size}">Hello</div>
        <button @click="update">Click</button>
    </div>
 
    <script>
        new Vue ({
            el: '#app',
            data :{
               red : 'red',
               size : '30px' 
            },
        });
    </script>
</body>
</html>
cs