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

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.

主站蜘蛛池模板: 吴桥县| 迭部县| 巴中市| 南充市| 宾川县| 巨野县| 武城县| 交城县| 鄂尔多斯市| 泾川县| 莱阳市| 泾川县| 通山县| 东乌珠穆沁旗| 阿尔山市| 诏安县| 绍兴县| 西畴县| 丹江口市| 洛阳市| 秭归县| 平利县| 常州市| 视频| 樟树市| 郎溪县| 新余市| 嘉兴市| 巴南区| 托克逊县| 丰镇市| 澄城县| 万山特区| 江达县| 阿拉善盟| 宜章县| 新河县| 古丈县| 贵德县| 资溪县| 抚松县|