官术网_书友最值得收藏!

The template option

If you look in the index.html file, you will see that the #app element is already there and empty. In fact, we won't write anything inside. Instead, we will use the template option directly on the definition object. Let's try it with a dumb template:

new Vue({
name: 'game',
el: '#app',

template: `<p id="#app">
Hello world!
</p>`,
})

Here, we used the new JavaScript strings, with the ` character (back quote). It allows us, among other things, to write text spanning multiple lines, without having to write verbose string concatenations.

Now if you open the app, you should see the 'Hello world!' text displayed. As you guessed, we won't inline the template in the #app element going forward.

主站蜘蛛池模板: 巴彦淖尔市| 香格里拉县| 当阳市| 泰兴市| 江山市| 韶关市| 城固县| 苗栗县| 饶阳县| 东海县| 兴化市| 鄂托克前旗| 长丰县| 景德镇市| 澄迈县| 贵港市| 肥城市| 定远县| 鄂托克前旗| 太原市| 旬邑县| 沁阳市| 闽侯县| 瓦房店市| 西藏| 都江堰市| 万源市| 新竹县| 犍为县| 嘉祥县| SHOW| 涟源市| 平湖市| 思茅市| 北安市| 夹江县| 武乡县| 内江市| 巩留县| 杭州市| 巴青县|