-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdemo.html
84 lines (81 loc) · 2.56 KB
/
demo.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>iview example</title>
<script type="text/javascript" src="http://vuejs.org/js/vue.min.js"></script>
<script type="text/javascript" src="../dist/index.js"></script>
</head>
<body>
<div id="app">
<flex-table resizable :loading="loading" :columns="columns" :data="list" :sum="sum">
<template slot-scope="{ row, index }" slot="operation">
<button style="margin-right: 5px" @click="show(index)">View</button>
<button @click="remove(index)">Delete</button>
</template>
</flex-table>
</div>
<script>
const aTestList = [];
for (let i = 0; i < 10; i++) {
const oTestData = {
name: 'John Brown',
age: 18,
address: 'New York No. 1 Lake Park',
date: '2016-10-03',
};
aTestList.push(oTestData);
}
new Vue({
el: '#app',
data() {
return {
columns: [
{
title: 'Name',
key: 'name',
},
{
title: 'Age',
key: 'age',
render(h, params) {
return h('span', 'age: ' + params.row.age)
}
},
{
title: 'Address',
key: 'address',
},
{
title: 'Date',
key: 'date',
},
{
title: 'operation',
key: 'operation',
type: 'slot',
},
],
loading: false,
list: aTestList,
sum: {
name: 'Jim Green',
age: 24,
address: 'London',
date: '2016-10-01',
},
}
},
mounted() { },
methods: {
show(index) {
alert('show ' + index);
},
remove(index) {
alert('remove ' + index);
}
}
})
</script>
</body>
</html>