Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4f59cc7

Browse files
committed
综合
1 parent 28f6c58 commit 4f59cc7

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

qibu-1/demo-1-05.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>综合</title>
6+
<script src="../js/vue.js"></script>
7+
</head>
8+
<body>
9+
<div id="app">
10+
<input v-model="newTodo" v-on:keyup.enter="addTodo"/>
11+
<ul>
12+
<li v-for="todo in todos">
13+
<span>{{ todo.text }}</span>
14+
<button v-on:click="removeTodo($index)">X</button>
15+
</li>
16+
</ul>
17+
</div>
18+
</body>
19+
<script>
20+
new Vue({
21+
el:'#app',
22+
data:{
23+
newTodo:'',
24+
todos:[
25+
{ text:'Add Some Todo'}
26+
]
27+
},
28+
methods:{
29+
addTodo:function(){
30+
var text = this.newTodo.trim();
31+
if(text){
32+
this.todos.push({text:text});
33+
this.newTodo = '';
34+
}
35+
},
36+
removeTodo:function(index){
37+
this.todos.splice(index,1);
38+
}
39+
}
40+
})
41+
</script>
42+
</html>

0 commit comments

Comments
 (0)