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

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

主站蜘蛛池模板: 德令哈市| 耒阳市| 德令哈市| 米脂县| 汽车| 鄂托克前旗| 南安市| 老河口市| 安丘市| 文成县| 仁寿县| 界首市| 库尔勒市| 镇安县| 东明县| 湘西| 涪陵区| 麟游县| 瑞安市| 台中县| 图们市| 大庆市| 临武县| 民乐县| 南昌市| 来宾市| 岳普湖县| 安图县| 应用必备| 牡丹江市| 连城县| 琼结县| 越西县| 溧阳市| 禹州市| 保康县| 江永县| 赤壁市| 肇源县| 花莲市| 莫力|