-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsenior04.html
87 lines (86 loc) · 1.72 KB
/
senior04.html
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<div id="container">
</div>
<script src="https://unpkg.com/vue"></script>
<script>
Vue.component("child-content", {
props: ["items"],
render: function (h) {
var _this = this;
return h(
"ul",
{
attrs: {
id: "ul_name"
}
},
[
/*this.items.map(function (item) {
return _this.$scopedSlots.myslot({
content: item.content,
id: item.id
})
}
)*/
this.items.map(item => {
return this.$scopedSlots.myslot(
{
content: item.content,
id: item.id
}
)
})
]
)
}
})
var container = new Vue({
el: "#container",
render: function (h) {
return h(
"child-content",
{
props: {
items: this.mycontents
},
scopedSlots: {
myslot: function (prop) {
return h(
"li",
{
attrs: {
id: prop.id
},
class: {
myclass: true
}
},
[
prop.content
]
)
}
}
}
)
},
computed: {
mycontents: function () {
return [
{id: "li_1", content: "内容1"},
{id: "li_2", content: "内容2"},
{id: "li_3", content: "内容3"},
{id: "li_4", content: "内容4"},
]
}
}
})
</script>
</body>
</html>