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

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!

主站蜘蛛池模板: 司法| 洛浦县| 洛浦县| 共和县| 汽车| 昭觉县| 利辛县| 峨眉山市| 苏尼特右旗| 兰考县| 米易县| 修文县| 犍为县| 霍城县| 贺兰县| 峨眉山市| 湖南省| 威海市| 太白县| 衡山县| 稻城县| 富阳市| 三河市| 环江| 洛扎县| 吉安县| 邯郸市| 定远县| 武强县| 万安县| 朝阳区| 夏邑县| 鄯善县| 北票市| 武汉市| 峨眉山市| 襄垣县| 镶黄旗| 南昌市| 柳江县| 育儿|