2cb8a6d9
梁灏
commit Table comp...
|
1
|
<template>
|
548eac43
梁灏
fixed #1387 and u...
|
2
|
<div>
|
51356c2c
梁灏
fixed #658
|
3
4
5
6
7
8
9
10
11
|
<Table
width="500"
height="200"
border
highlight-row
:columns="columns2"
@on-selection-change="change2"
:data="data3"></Table>
<Button @click="addData">添加数据</Button>
|
548eac43
梁灏
fixed #1387 and u...
|
12
|
</div>
|
2cb8a6d9
梁灏
commit Table comp...
|
13
14
|
</template>
<script>
|
51356c2c
梁灏
fixed #658
|
15
|
import test from '../components/test.vue';
|
2cb8a6d9
梁灏
commit Table comp...
|
16
|
export default {
|
51356c2c
梁灏
fixed #658
|
17
18
19
20
21
22
23
24
|
data () {
return {
columns2: [
// {
// type: 'selection',
// width: 60,
// align: 'center'
// },
|
10d3a323
Aresn
fixed #1011
|
25
|
{
|
119eeafe
梁灏
fixed a Table bug
|
26
|
title: '姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名姓名',
|
8b530b1c
梁灏
fixed #1342
|
27
|
key: 'name',
|
119eeafe
梁灏
fixed a Table bug
|
28
|
width: 200,
|
51356c2c
梁灏
fixed #658
|
29
30
|
// sortable: true,
// fixed: 'right',
|
8b530b1c
梁灏
fixed #1342
|
31
|
render: (h, params) => {
|
548eac43
梁灏
fixed #1387 and u...
|
32
33
34
35
36
37
38
39
40
41
42
|
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
on: {
click: this.edit
},
}, '修改')
]);
|
8b530b1c
梁灏
fixed #1342
|
43
|
}
|
51356c2c
梁灏
fixed #658
|
44
45
46
47
48
|
},
{
title: '年龄',
key: 'age',
sortable: true,
|
835b37ff
梁灏
fixed #1403
|
49
|
// sortType: 'asc',
|
119eeafe
梁灏
fixed a Table bug
|
50
|
width: 200
|
51356c2c
梁灏
fixed #658
|
51
52
53
54
55
56
|
},
{
title: '省份',
key: 'province',
sortable: true,
// fixed: 'right',
|
119eeafe
梁灏
fixed a Table bug
|
57
|
width: 200
|
51356c2c
梁灏
fixed #658
|
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
|
},
// {
// title: '市区',
// key: 'city',
// width: 100
// },
// {
// title: '地址',
// key: 'address',
// width: 200
// },
// {
// title: '邮编',
// key: 'zip',
// width: 100
// },
// {
// title: '操作',
// key: 'action',
// fixed: 'right',
// width: 120,
// render: (h, params) => {
// return h(test);
// }
// }
],
data3: [
|
835b37ff
梁灏
fixed #1403
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
{
name: '王小明',
age: 18,
address: '北京市朝阳区芍药居',
province: '北京市',
city: '朝阳区',
zip: 100000
},
{
name: '张小刚',
age: 25,
address: '北京市海淀区西二旗',
province: '北京市',
city: '海淀区',
zip: 100000
},
|
51356c2c
梁灏
fixed #658
|
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
// {
// name: '李小红',
// age: 30,
// address: '上海市浦东新区世纪大道',
// province: '上海市',
// city: '浦东新区',
// zip: 100000
// },
// {
// name: '周小伟',
// age: 26,
// address: '深圳市南山区深南大道',
// province: '广东',
// city: '南山区',
// zip: 100000
// }
|
8b530b1c
梁灏
fixed #1342
|
117
|
]
|
2cb8a6d9
梁灏
commit Table comp...
|
118
|
}
|
b0f1c61f
Rijn
add a event @on-s...
|
119
|
},
|
8b530b1c
梁灏
fixed #1342
|
120
|
methods: {
|
51356c2c
梁灏
fixed #658
|
121
122
123
124
125
126
127
128
|
change1 (d, l) {
// console.log(d)
// console.log(l)
},
change2 (d, l) {
console.log(d);
console.log(l);
},
|
548eac43
梁灏
fixed #1387 and u...
|
129
|
addData () {
|
51356c2c
梁灏
fixed #658
|
130
131
132
133
134
135
136
|
this.data3.push({
name: '周小伟',
age: 26,
address: '深圳市南山区深南大道',
province: '广东',
city: '南山区',
zip: 100000
|
548eac43
梁灏
fixed #1387 and u...
|
137
|
})
|
51356c2c
梁灏
fixed #658
|
138
139
140
|
},
edit () {
|
b0f1c61f
Rijn
add a event @on-s...
|
141
|
}
|
2cb8a6d9
梁灏
commit Table comp...
|
142
143
|
}
}
|
548eac43
梁灏
fixed #1387 and u...
|
144
|
</script>
|