Skip to content

Commit c49d912

Browse files
committed
forth commit fro desktop
1 parent a642bd1 commit c49d912

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

.index.html.un~

-11.5 KB
Binary file not shown.

.main.js.un~

9.95 KB
Binary file not shown.

index.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ <h2>data binding</h2>
4141
</ul>
4242

4343
<input v-model="name">
44-
<button v-on:click="doAdd">Add monster</button>
44+
<button v-on:click="doAdd">Add monster</button>
4545
<ul>
46-
<li v-for="item in list" v-bind:key="item.id">
47-
ID.{{item.id}}{{item.name}} HP.{{item.hp}}
48-
</li>
46+
<li v-for="item in list1" v-bind:key="item.id">
47+
ID.{{item.id}} {{item.name}} HP.{{item.hp}}
48+
<buttom v-on:click="doRemove(index)">delete monster</buttom>
49+
</li>
4950
</ul>
5051

5152
</div>

index.html~

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@
3131
<p v-bind:class="classObject">Text</p>
3232
<p v-bind:style="styleObject">Text</p>
3333

34-
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" >
35-
<circle cx="100" cy="75" v-bind:r="radius" fill="lightpink/">
36-
</svg>
37-
<input type="range" min="0" max="100" v-model="radius">
34+
<div v-if="ok">v-if conditional branching</div>
35+
<div v-show="ok">v-show conditional branching</div>
36+
<ul>
37+
<li v-for="item in list1" v-bind:key="item.id" v-bind:class="{tuyoi:item.hp>300}">
38+
ID.{{item.id}} {{item.name}} HP.{{item.hp}}
39+
<span v-if="item.hp>300">strong!</span>
40+
</li>
41+
</ul>
3842

3943
<input v-model="name">
4044
<button v-on:click="doAdd">Add monster</button>

main.js~

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ var app = new Vue({
1919
backgroundColor: 'lightgray',
2020
},
2121
radius:50,
22+
ok: true,
23+
name:"kimaira",
24+
list1:[
25+
{id:1, name:'slime', hp:100},
26+
{id:2, name:'goblin',hp:200},
27+
{id:3, name:'dragon',hp:500},
28+
],
2229
},
2330
methods:{
2431
handleClick:function(event){
@@ -27,6 +34,17 @@ var app = new Vue({
2734
increment: function(){
2835
this.count+=1
2936
},
37+
doAdd:function(){
38+
var max=this.list.reduce(function(a,b){
39+
return a>b.id ? a:b.id
40+
41+
},0)
42+
this.list.push({
43+
id:max+1,
44+
name:this.name,
45+
hp:500,
46+
})
47+
},
3048
},
3149
mounted:function(){
3250
this.scroll=100

0 commit comments

Comments
 (0)