-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
leo
committed
Aug 14, 2019
1 parent
f423659
commit 2670d7a
Showing
6 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#bag{ | ||
width:200px; | ||
height: 500px; | ||
background: url(../img/bag.png) center no-repeat; | ||
margin: 0 auto; | ||
background-size: 60%; | ||
} | ||
#bag.burst{ | ||
background: url(../img/bag_burst.png) center no-repeat; | ||
background-size: 60%; | ||
} | ||
|
||
|
||
#bag-health{ | ||
width: 200px; | ||
border: 2px solid black; | ||
margin: 0 auto 20px auto; | ||
} | ||
|
||
#bag-health div{ | ||
background: red; | ||
height: 20px; | ||
} | ||
|
||
#controls{ | ||
width: 200px; | ||
margin: 0 auto; | ||
|
||
} | ||
|
||
#controls button{ | ||
margin-left: 20px; | ||
color: #fff; | ||
background: gray; | ||
border: 1px solid #fff; | ||
border-radius: 6px;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>demo</title> | ||
<link rel="stylesheet" type="text/css" href="css/demo_style.css" /> | ||
<script src="js/vue.min.js" type="text/javascript" charset="utf-8"></script> | ||
</head> | ||
|
||
<body> | ||
<div id="vue-app"> | ||
<!--图片--> | ||
<div id="bag" v-bind:class="{burst:ended}"> | ||
</div> | ||
<!--进度条--> | ||
<div id="bag-health"> | ||
<div v-bind:style="{width:health+'%'}"></div> | ||
</div> | ||
<!--控制按钮--> | ||
<div id="controls"> | ||
<!--<h1>{{health}}</h1> | ||
<p>{{ended}}</p>--> | ||
<button v-on:click="punch" v-show="!ended">盘他!</button> | ||
<button @click="restart">重新开始</button> | ||
</div> | ||
</div> | ||
<script src="js/demo_app.js" type="text/javascript" charset="utf-8"></script> | ||
</body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
new Vue({ | ||
el:"#vue-app", | ||
data:{ | ||
health: 100, | ||
ended: false | ||
}, | ||
methods:{ | ||
punch: function(){ | ||
this.health -= 10; | ||
if(this.health <= 0){ | ||
this.ended = true; | ||
} | ||
}, | ||
restart:function(){ | ||
this.health = 100; | ||
this.ended= false; | ||
}, | ||
}, | ||
computed:{ | ||
|
||
|
||
} | ||
|
||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.