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

Setting up the project

Download the chapter 2 files and extract the project setup into an empty folder. You should have the following content:

  • index.html: The web page
  • style.css: The CSS file
  • svg: Contains all the SVG images of the game
  • cards.js: With all the cards data ready to use
  • state.js: Where we will consolidate the main data properties of the game
  • utils.js: Where we will write useful functions
  • banner-template.svg: We will use the content of this file later

We will start with our main JavaScript file--create a new file called main.js.

Open the index.html file and add a new script tag referencing the new file, just after the state.js one:

<!-- Scripts -->
<script src="utils.js"></script>
<script src="cards.js"></script>
<script src="state.js"></script>
<script src="main.js"></script>

Let's create the main instance of our app in the main.js file:

new Vue({
name: 'game',
el: '#app',
})

We are now ready to go!

主站蜘蛛池模板: 肇东市| 德州市| 泰兴市| 溧阳市| 宁南县| 甘孜| 青冈县| 日照市| 茶陵县| 静海县| 大名县| 深州市| 博兴县| 沂水县| 邳州市| 阜宁县| 镇江市| 饶阳县| 饶阳县| 河西区| 乡城县| 那坡县| 沙湾县| 罗定市| 许昌市| 喀什市| 桂阳县| 井冈山市| 金华市| 梁河县| 大悟县| 大兴区| 邹平县| 山丹县| 茌平县| 科尔| 常宁市| 错那县| 瓦房店市| 庄浪县| 保山市|