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

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.

主站蜘蛛池模板: 贵阳市| 大同市| 汾阳市| 姚安县| 勃利县| 龙山县| 乃东县| 岗巴县| 康乐县| 岚皋县| 大荔县| 富源县| 兖州市| 界首市| 时尚| 阿尔山市| 兖州市| 日照市| 团风县| 电白县| 遂昌县| 天镇县| 余姚市| 安塞县| 惠水县| 万宁市| 镇雄县| 元氏县| 西盟| 阿克苏市| 中卫市| 罗江县| 杭锦后旗| 鲜城| 五原县| 东莞市| 沾益县| 宁阳县| 丽江市| 湾仔区| 龙口市|