forked from feiyy/test20200527
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistrendering.html
More file actions
65 lines (60 loc) · 1.21 KB
/
listrendering.html
File metadata and controls
65 lines (60 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<ul>
<li v-for="(item, index) in items" :key="item.message">
{{index}} | {{item.message}}
</li>
</ul>
<ul id="v-for-object" class="demo">
<li v-for="value in object">
{{ value }}
</li>
</ul>
<button type="button" @click="changev">change array element</button>
<ul>
<li v-for="item in evenNumber">
{{item}}
</li>
</ul>
</div>
<script type="text/javascript">
var app = new Vue({
el:"#app",
data:{
numbers:[1,2,3,4,5],
parentMessage: 'Parent',
items: [
{ message: 'Foo' },
{ message: 'Bar' }
],
object: {
title: 'How to do lists in Vue',
author: 'Jane Doe',
publishedAt: '2016-04-10'
}
},
computed:{
evenNumber()
{
return this.numbers.filter(function(item){
return item%2==0
})
}
},
methods:{
changev()
{
Vue.set(this.items,0,{message:'xxx'})
}
}
})
</script>
</body>
</html>