File tree Expand file tree Collapse file tree 3 files changed +12
-61
lines changed Expand file tree Collapse file tree 3 files changed +12
-61
lines changed Original file line number Diff line number Diff line change 1
- new Vue ( {
2
- el : '#vue-app' ,
3
- data : {
4
- health : 100 ,
5
- ended : false
6
- } ,
7
- methods : {
8
- punch : function ( ) {
9
- this . health -= 10 ;
10
- if ( this . health <= 0 ) {
11
- this . ended = true ;
12
- }
13
- } ,
14
- restart : function ( ) {
15
- this . health = 100 ;
16
- this . ended = false ;
17
- }
18
- } ,
19
- computed : {
1
+ Vue . component ( 'greeting' , {
2
+ template : '<p>Hey there, I am a re-usable component</p>'
3
+ } ) ;
20
4
21
- }
5
+ new Vue ( {
6
+ el : '.vue-app-one'
7
+ /*template: '<p>I am a template</p>'*/
22
8
} ) ;
Original file line number Diff line number Diff line change 7
7
< script src ="https://unpkg.com/vue "> </ script >
8
8
</ head >
9
9
< body >
10
- < div id ="vue-app ">
11
- <!-- bag image -->
12
- < div id ="bag " v-bind:class ="{ burst: ended } "> </ div >
13
-
14
- <!-- bag health bar -->
15
- < div id ="bag-health ">
16
- < div v-bind:style ="{ width: health + '%' } "> </ div >
17
- </ div >
18
-
19
- <!-- game control buttons -->
20
- < div id ="controls ">
21
- < button v-on:click ="punch " v-show ="!ended "> Punch</ button >
22
- < button v-on:click ="restart "> Restart</ button >
23
- </ div >
10
+ < h1 > Templates</ h1 >
11
+ < div class ="vue-app-one ">
12
+ < greeting > </ greeting >
13
+ < greeting > </ greeting >
24
14
</ div >
15
+ <!--<div class="vue-app-one"></div>-->
16
+
25
17
</ body >
26
18
27
19
< script src ="app.js "> </ script >
Original file line number Diff line number Diff line change 1
- # bag {
2
- width : 200px ;
3
- height : 500px ;
4
- margin : 0 auto;
5
- background : url (/img/bag.png) center no-repeat;
6
- background-size : 80% ;
7
- }
8
-
9
- # bag .burst {
10
- background-image : url (/img/bag-burst.png);
11
- }
12
-
13
- # bag-health {
14
- width : 200px ;
15
- border : 2px solid # 000 ;
16
- margin : 0 auto 20px auto;
17
- }
18
-
19
- # bag-health div {
20
- height : 20px ;
21
- background : crimson
22
- }
23
-
24
- # controls {
25
- width : 120px ;
26
- margin : 0 auto;
27
- }
You can’t perform that action at this time.
0 commit comments