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

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

主站蜘蛛池模板: 新乡县| 麦盖提县| 赤峰市| 卢氏县| 翁源县| 云梦县| 德昌县| 邻水| 舒城县| 古交市| 新巴尔虎左旗| 诏安县| 米脂县| 晋中市| 苍南县| 景宁| 大荔县| 临江市| 信阳市| 宁强县| 盘山县| 驻马店市| 台湾省| 呼伦贝尔市| 涞水县| 盱眙县| 武威市| 红桥区| 安庆市| 永丰县| 平湖市| 深州市| 正安县| 绵阳市| 太康县| 绍兴市| 德令哈市| 大姚县| 固始县| 西城区| 青海省|