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

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!

主站蜘蛛池模板: 平阳县| 九台市| 肇源县| 沅陵县| 德清县| 白水县| 唐河县| 饶阳县| 兰考县| 岳阳县| 襄垣县| 阳谷县| 苗栗市| 衡东县| 台中县| 龙南县| 石首市| 社会| 高碑店市| 云梦县| 连城县| 梁平县| 云龙县| 万源市| 嘉荫县| 即墨市| 甘德县| 正阳县| 曲阜市| 佛冈县| 兴业县| 驻马店市| 嘉鱼县| 青州市| 嘉兴市| 沙田区| 柞水县| 宁强县| 武汉市| 耒阳市| 东丰县|