<!DOCTYPE html>
<html>
<head>
<title>VUE入门</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<style type="text/css">
.root h1{
color:red;
}
</style>
</head>
<body>
<div id="root" class="root">
</div>
<script type="text/javascript">
new Vue({
el:"#root",
template:"<h1>{{msg}}</h1>",
data:{
msg:"Hello 2332",
}
})
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue 测试实例 - 菜鸟教程(runoob.com)</title>
<script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
<style>
.H1TEST{
color:red;
}
</style>
</head>
<body>
<div id="app"></div>
<script>
new Vue({
el: '#app',
template:'<h1 v-bind:class="classObject"> TESTVUECSS </h1>',
data: {
classObject: {
H1TEST: true
}
}
})
</script>
</body>
</html>
作为模版内容,外部css代码无法改变样式