Skip to content

Commit 5e72f36

Browse files
committed
完善示例
1 parent 9169f63 commit 5e72f36

File tree

3 files changed

+86
-17
lines changed

3 files changed

+86
-17
lines changed

examples/src/comp/locale/index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ export default {
3434
openInCodeSandBox: "在 CodeSandBox 中编辑",
3535
},
3636
completeDemo: {
37+
dataRowsOption: [
38+
{
39+
value: "1000",
40+
label: "1000 行",
41+
},
42+
{
43+
value: "10000",
44+
label: "10,000 行",
45+
},
46+
{
47+
value: "100000",
48+
label: "100,000 行",
49+
},
50+
],
51+
dataRows: "数据量:",
3752
theme: "暗黑主题:",
3853
columnFixed: "列固定:",
3954
loading: "Loading:",
@@ -73,6 +88,21 @@ export default {
7388
openInCodeSandBox: "Edit in CodeSandBox",
7489
},
7590
completeDemo: {
91+
dataRowsOption: [
92+
{
93+
value: "1000",
94+
label: "1000 Rows",
95+
},
96+
{
97+
value: "10000",
98+
label: "10,000 Rows",
99+
},
100+
{
101+
value: "100000",
102+
label: "100,000 Rows",
103+
},
104+
],
105+
dataRows: "Data Rows:",
76106
theme: "Dark Theme:",
77107
columnFixed: "Fixed Columns:",
78108
loading: "Loading:",

examples/src/demo/index.vue

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,36 @@
44
<div class="operation">
55
<div class="operation-item">
66
<el-row :gutter="20">
7+
<el-col :span="4">
8+
{{ currentLocal["dataRows"] }}
9+
<el-select
10+
v-model="dataRow"
11+
style="width: 60%"
12+
size="small"
13+
@change="dataRowChange"
14+
>
15+
<el-option
16+
v-for="item in currentLocal[
17+
'dataRowsOption'
18+
]"
19+
:key="item.value"
20+
:label="item.label"
21+
:value="item.value"
22+
></el-option>
23+
</el-select>
24+
</el-col>
725
<el-col :span="3">
8-
{{ currentLocal["theme"] }}
26+
{{ currentLocal["columnFixed"] }}
927
<el-switch
10-
v-model="enableDarkTheme"
28+
v-model="enableColumnFixed"
1129
:active-color="switchActiveColor"
1230
:inactive-color="switchInactiveColor"
13-
@change="switchTheme"
1431
></el-switch>
1532
</el-col>
16-
1733
<el-col :span="3">
18-
{{ currentLocal["columnFixed"] }}
34+
{{ currentLocal["expand"] }}
1935
<el-switch
20-
v-model="enableColumnFixed"
36+
v-model="enableExpand"
2137
:active-color="switchActiveColor"
2238
:inactive-color="switchInactiveColor"
2339
></el-switch>
@@ -32,31 +48,31 @@
3248
></el-switch>
3349
</el-col>
3450
<el-col :span="3">
35-
{{ currentLocal["expand"] }}
51+
{{ currentLocal["radio"] }}
3652
<el-switch
37-
v-model="enableExpand"
53+
v-model="enableRowRadio"
3854
:active-color="switchActiveColor"
3955
:inactive-color="switchInactiveColor"
4056
></el-switch>
4157
</el-col>
4258
<el-col :span="3">
43-
{{ currentLocal["radio"] }}
59+
{{ currentLocal["checkbox"] }}
4460
<el-switch
45-
v-model="enableRowRadio"
61+
v-model="enableRowCheckbox"
4662
:active-color="switchActiveColor"
4763
:inactive-color="switchInactiveColor"
4864
></el-switch>
4965
</el-col>
5066
<el-col :span="3">
51-
{{ currentLocal["checkbox"] }}
67+
{{ currentLocal["theme"] }}
5268
<el-switch
53-
v-model="enableRowCheckbox"
69+
v-model="enableDarkTheme"
5470
:active-color="switchActiveColor"
5571
:inactive-color="switchInactiveColor"
72+
@change="switchTheme"
5673
></el-switch>
5774
</el-col>
58-
<el-col :span="3"></el-col>
59-
<el-col :span="3"></el-col>
75+
<el-col :span="2"></el-col>
6076
</el-row>
6177
</div>
6278
<!-- <div class="operation-item">
@@ -108,6 +124,7 @@ export default {
108124
mixins: [I18nMixins, ThemeSwitchMixins],
109125
data() {
110126
return {
127+
dataRow: 1000,
111128
switchActiveColor: "#1890ff",
112129
switchInactiveColor: "rgba(0,0,0,.25)",
113130
@@ -515,6 +532,15 @@ export default {
515532
this.filter();
516533
},
517534
535+
// data row change
536+
dataRowChange() {
537+
setTimeout(() => {
538+
this.initSourceData();
539+
// scroll to top
540+
this.$refs["tableRef"].scrollTo({ top: 0 });
541+
});
542+
},
543+
518544
initSourceData() {
519545
const PROFESSIONS = [
520546
"Project Manager",
@@ -526,7 +552,9 @@ export default {
526552
];
527553
528554
let data = [];
529-
for (let i = 0; i < 10000; i++) {
555+
556+
const dataRow = this.dataRow;
557+
for (let i = 0; i < dataRow; i++) {
530558
data.push({
531559
rowKey: i,
532560
rowIndex: i + 1,
@@ -567,10 +595,11 @@ export default {
567595
padding: 10px;
568596
569597
.operation {
570-
margin: 30px 0;
598+
margin: 10px 0;
571599
572600
.operation-item {
573601
height: 50px;
602+
line-height: 50px;
574603
}
575604
}
576605

examples/src/main.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,22 @@ Vue.component("demo-block", DemoBlock);
2424
Vue.component("anchor", Anchor);
2525

2626
// 仅用作示例
27-
import { Switch, Row, Col, RadioButton, RadioGroup } from "element-ui";
27+
import {
28+
Switch,
29+
Row,
30+
Col,
31+
RadioButton,
32+
RadioGroup,
33+
Select,
34+
Option,
35+
} from "element-ui";
2836
Vue.use(Switch);
2937
Vue.use(Row);
3038
Vue.use(Col);
3139
Vue.use(RadioButton);
3240
Vue.use(RadioGroup);
41+
Vue.use(Select);
42+
Vue.use(Option);
3343

3444
// vue-lazy-container
3545
import VueLazyContainer from "vue-lazy-container";

0 commit comments

Comments
 (0)