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

Installing Vue.js

Now it's time to add the Vue.js library to our project. Vue was downloaded as part of our NPM install, so now we can simply link to the browser-build of Vue.js with ascripttag.

index.html:

<body>
<p id="toolbar">...</p>
<p id="app">...</p>
<script src="node_modules/vue/dist/vue.js"></script>
<script src="app.js"></script>
</body>

It's important that we include the Vue librarybeforeour own customapp.jsscript, as scripts run sequentially.

Vue will now be registered as a global object. We can test this by going to our browser and typing the following in the JavaScript console:

console.log(Vue);

Here is the result:

Figure 2.3. Checking Vue is registered as a global object

主站蜘蛛池模板: 灵石县| 宣化县| 建阳市| 临武县| 遵化市| 河池市| 双峰县| 静安区| 阳山县| 普格县| 平阴县| 阿鲁科尔沁旗| 崇明县| 寻甸| 同仁县| 固始县| 宣化县| 元阳县| 报价| 疏勒县| 呼图壁县| 佛坪县| 来安县| 忻州市| 通辽市| 惠安县| 盐亭县| 玉门市| 科技| 梁平县| 牡丹江市| 濮阳市| 兰溪市| 扶风县| 甘肃省| 峡江县| 黎川县| 古交市| 达日县| 金湖县| 林西县|