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

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

主站蜘蛛池模板: 农安县| 浮山县| 临汾市| 临夏县| 漳州市| 浮山县| 合肥市| 井研县| 新宾| 云和县| 黎川县| 平邑县| 博客| 乌什县| 清原| 卓尼县| 永登县| 介休市| 女性| 读书| 汉中市| 澎湖县| 连山| 延川县| 吐鲁番市| 维西| 阳谷县| 江都市| 旬邑县| 神木县| 和硕县| 申扎县| 清远市| 阜南县| 承德县| 大姚县| 临城县| 鱼台县| 平顺县| 岑溪市| 甘孜|