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

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.

主站蜘蛛池模板: 崇州市| 隆回县| 策勒县| 霍城县| 普兰县| 新竹市| 冕宁县| 丹东市| 景德镇市| 布尔津县| 衢州市| 蓬溪县| 通江县| 辉南县| 济宁市| 古浪县| 嵩明县| 瓮安县| 泽库县| 昆山市| 宜兰市| 广元市| 贡嘎县| 黑水县| 墨玉县| 延吉市| 宁武县| 峡江县| 兖州市| 腾冲县| 周宁县| 西乌珠穆沁旗| 丹巴县| 铜梁县| 阳朔县| 睢宁县| 庄河市| 贵溪市| 志丹县| 梁山县| 阳城县|