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

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.

主站蜘蛛池模板: 宿松县| 铜陵市| 牡丹江市| 拉萨市| 沙河市| 临城县| 申扎县| 汝南县| 胶南市| 绥德县| 雷波县| 固始县| 临潭县| 乐都县| 英山县| 平顺县| 庆阳市| 东宁县| 岚皋县| 临颍县| 丽江市| 昔阳县| 平舆县| 格尔木市| 昌图县| 枣强县| 泰兴市| 蕲春县| 怀化市| 云林县| 通辽市| 石首市| 达孜县| 曲麻莱县| 辽源市| 锦州市| 靖安县| 咸宁市| 分宜县| 泸溪县| 清原|