Vue.js05:vue内联样式

时间:2022-09-29 16:25:46

对象就是无序键值对的集合

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<h1 on-cloak>{{ msg }}</h1>
<h1 :style="{color: 'red', 'font-width': 200}">周日被我射熄火了,所以今天是周一</h1>
<h1 :style="styleObj2">起床起床,老板喊你加班了</h1>
<h1 :style="styleObj3">小乔,要努力变强</h1>
</div>
</body>
<script>
let vm = new new Vue({
el: '#app',
data: {
msg: '瞅你咋地?再瞅一个试试',
styleObj1: {color: 'red', 'font-width': 200},
styleObj2: {'font-style': 'italic'},
styleObj3: {color: 'skyblue', 'font-width': 400}
},
methods: { }
})
</script>
</html>