渲染時<div class="root"></div>不見了
<div class="root"></div>
<script>
new Vue({
el: '.root',
template: '<h1>{{msg}}</h1>',
data: {
msg: "hello word"
}
})
</script>
為什么在頁面渲染的時候是
<h1>hello word</h1>
而不是
<div class="root"><h1>hello word</h1></div>
<div class="root"></div>
<script>
new Vue({
el: '.root',
template: '<h1>{{msg}}</h1>',
data: {
msg: "hello word"
}
})
</script>
為什么在頁面渲染的時候是
<h1>hello word</h1>
而不是
<div class="root"><h1>hello word</h1></div>
2018-08-09
舉報
2018-12-27
template: '<div class="root"><h1>{{msg}}</h1></div>',
簡單理解為獲取一個div元素,把獲取的這部分元素完全替換template里的內(nèi)容
2018-08-09
template屬性內(nèi)容會替換掉掛載點(diǎn) 到后面的組件開發(fā)會有說明