-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10.html
71 lines (68 loc) · 1.18 KB
/
10.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>task-10</title>
<script src="vue/vue.js"></script>
<style>
</style>
</head>
<body>
<div id="app-01">
<smart-list :items="list"></smart-list>
</div>
<script>
var EmptyList="hello im em",
TabelList=[
"111",
"222",
"333"
],
OrderedList=[
"aaa",
"bbb",
"ccc"
],
UnorderedList=[
"ddd",
"eee",
"fff"
]
Vue.component('smart-list',{
functional:true,
render:function(createElement,context){
function app(){
var items=context.props.items
if(items.length===0) return EmptyList
if(typeof items[0]==='object') return TabelList
if(context.props.isOrdered) return OrderedList
return UnorderedList
}
return createElement(
'ul',
app(),
context.data,
context.children
)
},
props:{
items:{
type:String,
required:true
},
isOrdered:Boolean
}
})
var app01=new Vue({
el:'#app-01',
data:{
list:[1,2,3]
}
})
function a(m){
alert(m)
console.log(m)
}
</script>
</body>
</html>