Skip to content

Commit 76db9d4

Browse files
author
huangshuwei
committed
完善示例
1 parent 812a5b5 commit 76db9d4

File tree

2 files changed

+72
-9
lines changed

2 files changed

+72
-9
lines changed

examples/src/comp/locale/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ export default {
2929
},
3030
completeDemo: {
3131
columnFixed: "列固定:",
32-
loading: "Loading:",
33-
expand: "行展开"
32+
loading: "Loading:",
33+
expand: "行展开:",
34+
radio: "行单选:",
35+
checkbox: "行多选:"
3436
}
3537
},
3638
en: {
@@ -60,7 +62,9 @@ export default {
6062
completeDemo: {
6163
columnFixed: "Fixed Columns:",
6264
loading: "Loading:",
63-
expand: "Row Expand"
65+
expand: "Row Expand:",
66+
radio: "Row Radio:",
67+
checkbox: "Row Checkbox:"
6468
}
6569
}
6670
};

examples/src/demo/index.vue

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,36 @@
2222
>
2323
</el-switch>
2424
</el-col>
25-
<el-col :span="3"
26-
>{{ currentLocal["expand"] }}
25+
<el-col :span="3">
26+
{{ currentLocal["expand"] }}
2727
<el-switch
2828
v-model="enableExpand"
2929
:active-color="switchActiveColor"
3030
:inactive-color="switchInactiveColor"
3131
@change="switchLoading"
3232
>
33-
</el-switch
34-
></el-col>
35-
<el-col :span="3"><div></div></el-col>
36-
<el-col :span="3"><div></div></el-col>
33+
</el-switch>
34+
</el-col>
35+
<el-col :span="3">
36+
{{ currentLocal["radio"] }}
37+
<el-switch
38+
v-model="enableRowRadio"
39+
:active-color="switchActiveColor"
40+
:inactive-color="switchInactiveColor"
41+
@change="switchLoading"
42+
>
43+
</el-switch>
44+
</el-col>
45+
<el-col :span="3">
46+
{{ currentLocal["checkbox"] }}
47+
<el-switch
48+
v-model="enableRowCheckbox"
49+
:active-color="switchActiveColor"
50+
:inactive-color="switchInactiveColor"
51+
@change="switchLoading"
52+
>
53+
</el-switch>
54+
</el-col>
3755
<el-col :span="3"><div></div></el-col>
3856
<el-col :span="3"><div></div></el-col>
3957
<el-col :span="3"><div></div></el-col>
@@ -52,6 +70,8 @@
5270
row-key-field-name="rowKey"
5371
:cell-style-option="cellStyleOption"
5472
:expand-option="expandOption"
73+
:radio-option="radioOption"
74+
:checkbox-optipon="checkboxOptipon"
5575
/>
5676
</div>
5777
<!-- <Footer /> -->
@@ -76,6 +96,8 @@ export default {
7696
enableColumnFixed: true,
7797
enableLoading: false,
7898
enableExpand: true,
99+
enableRowRadio: false,
100+
enableRowCheckbox: false,
79101
80102
// ---------------table options---------------
81103
tableData: [],
@@ -90,6 +112,21 @@ export default {
90112
// 是否开启
91113
enable: true
92114
},
115+
radioOption: {
116+
selectedRowChange: ({ row }) => {
117+
console.log(row);
118+
}
119+
},
120+
checkboxOptipon: {
121+
// row select change event
122+
selectedRowChange: ({ row, isSelected, selectedRowKeys }) => {
123+
console.log(row, isSelected, selectedRowKeys);
124+
},
125+
// selected all change event
126+
selectedAllChange: ({ isSelected, selectedRowKeys }) => {
127+
console.log(isSelected, selectedRowKeys);
128+
}
129+
},
93130
expandOption: {
94131
render: ({ row, column, rowIndex }, h) => {
95132
return (
@@ -113,6 +150,28 @@ export default {
113150
columns() {
114151
let columns = [];
115152
153+
if (this.enableRowRadio) {
154+
columns.push({
155+
field: "radio",
156+
key: "radio",
157+
title: "",
158+
width: 30,
159+
fixed: this.enableColumnFixed ? "left" : "",
160+
type: "radio"
161+
});
162+
}
163+
164+
if (this.enableRowCheckbox) {
165+
columns.push({
166+
field: "checkbox",
167+
key: "checkbox",
168+
title: "",
169+
width: 30,
170+
fixed: this.enableColumnFixed ? "left" : "",
171+
type: "checkbox"
172+
});
173+
}
174+
116175
if (this.enableExpand) {
117176
columns.push({
118177
field: "expand",

0 commit comments

Comments
 (0)