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

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.

主站蜘蛛池模板: 腾冲县| 油尖旺区| 柳林县| 黎川县| 郴州市| 丹东市| 昔阳县| 贺兰县| 中方县| 德州市| 新竹县| 靖江市| 红桥区| 威远县| 淳安县| 麦盖提县| 陵川县| 胶南市| 丹凤县| 五常市| 铜梁县| 汾阳市| 榆社县| 乌拉特中旗| 吴忠市| 额敏县| 吴桥县| 十堰市| 正安县| 高青县| 东海县| 玛沁县| 固阳县| 米脂县| 特克斯县| 岫岩| 库车县| 黔江区| 盐源县| 陆河县| 沂源县|