Skip to content

Commit 075066f

Browse files
committed
add show header doc
1 parent 1f40dd6 commit 075066f

File tree

11 files changed

+216
-3
lines changed

11 files changed

+216
-3
lines changed

CHANGE-LOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ V2.18.0
2323
- 添加单元格批量复制功能
2424
- 添加单元格批量粘贴功能
2525
- 添加单元格批量剪切功能
26+
- 添加隐藏表头功能
2627

2728
### Bug Fixes
2829

examples/src/docs/en/ve-table/api/db.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export const db = {
104104
data: [
105105
{
106106
param: "tableData",
107-
desc: "table data",
107+
desc: "Table data",
108108
type: "<code>Array</code>",
109109
optionalVal: "-",
110110
default: "-",
@@ -123,6 +123,13 @@ export const db = {
123123
optionalVal: "-",
124124
default: "-",
125125
},
126+
{
127+
param: "showHeader",
128+
desc: `Show header`,
129+
type: `<code>Boolean</code>`,
130+
optionalVal: "-",
131+
default: "true",
132+
},
126133
{
127134
param: "fixedHeader",
128135
desc: "Is the header fixed,Enabled by default.It needs to be used in combination with `maxHeight`",
@@ -189,7 +196,7 @@ export const db = {
189196
},
190197
{
191198
param: "cellStyleOption",
192-
desc: "cell style option,Refer to cellStyleOption option for details",
199+
desc: "Cell style option,Refer to cellStyleOption option for details",
193200
type: "<code>Object</code>",
194201
optionalVal: "-",
195202
default: "-",
@@ -203,7 +210,7 @@ export const db = {
203210
},
204211
{
205212
param: "expandOption",
206-
desc: "row expand option,Refer to expandOption option for details",
213+
desc: "Row expand option,Refer to expandOption option for details",
207214
type: "<code>Object</code>",
208215
optionalVal: "-",
209216
default: "-",
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
:::anchor Header Hidden
2+
3+
:::demo
4+
5+
```html
6+
<template>
7+
<div>
8+
<el-radio-group @change="autofillTypeChang" v-model="showHeaderRadio">
9+
<el-radio label="Show">Show</el-radio>
10+
<el-radio label="Hidden">Hidden</el-radio>
11+
</el-radio-group>
12+
<br />
13+
<br />
14+
<ve-table
15+
:show-header="showHeader"
16+
:columns="columns"
17+
:table-data="tableData"
18+
rowKeyFieldName="rowKey"
19+
/>
20+
</div>
21+
</template>
22+
23+
<script>
24+
export default {
25+
data() {
26+
return {
27+
showHeaderRadio: "Hidden",
28+
columns: [
29+
{ field: "col1", key: "col1", title: "Col1" },
30+
{ field: "col2", key: "col2", title: "Col2" },
31+
{ field: "col3", key: "col3", title: "Col3" },
32+
{ field: "col4", key: "col4", title: "Col4" },
33+
{ field: "col5", key: "col5", title: "Col5" },
34+
{ field: "col6", key: "col6", title: "Col6" },
35+
],
36+
tableData: [],
37+
};
38+
},
39+
computed: {
40+
showHeader() {
41+
return this.showHeaderRadio === "Show";
42+
},
43+
},
44+
methods: {
45+
initTableData() {
46+
let data = [];
47+
for (let i = 0; i < 8; i++) {
48+
data.push({
49+
rowKey: i,
50+
col1: `A${i + 1}`,
51+
col2: `B${i + 1}`,
52+
col3: `C${i + 1}`,
53+
col4: `D${i + 1}`,
54+
col5: `E${i + 1}`,
55+
col6: `F${i + 1}`,
56+
col7: `G${i + 1}`,
57+
col8: `H${i + 1}`,
58+
});
59+
}
60+
this.tableData = data;
61+
},
62+
},
63+
created() {
64+
this.initTableData();
65+
},
66+
};
67+
</script>
68+
```
69+
70+
:::
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:::tip
2+
1、The header is displayed by default. You can use `:fixed-header="false"` to hide the header
3+
:::
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div>
3+
<h2>Header Hidden</h2>
4+
<Explain />
5+
<Base />
6+
</div>
7+
</template>
8+
<script>
9+
import Explain from "./explain.md";
10+
import Base from "./base.md";
11+
12+
export default {
13+
name: "basic-main",
14+
components: {
15+
Explain,
16+
Base,
17+
},
18+
};
19+
</script>

examples/src/docs/zh/ve-table/api/db.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,13 @@ export const db = {
123123
optionalVal: "-",
124124
default: "-",
125125
},
126+
{
127+
param: "showHeader",
128+
desc: `是否展示表头`,
129+
type: `<code>Boolean</code>`,
130+
optionalVal: "-",
131+
default: "true",
132+
},
126133
{
127134
param: "fixedHeader",
128135
desc: "是否固定表头,默认启用。需要和 `maxHeight`结合使用",
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
:::anchor 隐藏表头
2+
3+
:::demo
4+
5+
```html
6+
<template>
7+
<div>
8+
<el-radio-group @change="autofillTypeChang" v-model="showHeaderRadio">
9+
<el-radio label="Show">Show</el-radio>
10+
<el-radio label="Hidden">Hidden</el-radio>
11+
</el-radio-group>
12+
<br />
13+
<br />
14+
<ve-table
15+
:show-header="showHeader"
16+
:columns="columns"
17+
:table-data="tableData"
18+
rowKeyFieldName="rowKey"
19+
/>
20+
</div>
21+
</template>
22+
23+
<script>
24+
export default {
25+
data() {
26+
return {
27+
showHeaderRadio: "Hidden",
28+
columns: [
29+
{ field: "col1", key: "col1", title: "Col1" },
30+
{ field: "col2", key: "col2", title: "Col2" },
31+
{ field: "col3", key: "col3", title: "Col3" },
32+
{ field: "col4", key: "col4", title: "Col4" },
33+
{ field: "col5", key: "col5", title: "Col5" },
34+
{ field: "col6", key: "col6", title: "Col6" },
35+
],
36+
tableData: [],
37+
};
38+
},
39+
computed: {
40+
showHeader() {
41+
return this.showHeaderRadio === "Show";
42+
},
43+
},
44+
methods: {
45+
initTableData() {
46+
let data = [];
47+
for (let i = 0; i < 8; i++) {
48+
data.push({
49+
rowKey: i,
50+
col1: `A${i + 1}`,
51+
col2: `B${i + 1}`,
52+
col3: `C${i + 1}`,
53+
col4: `D${i + 1}`,
54+
col5: `E${i + 1}`,
55+
col6: `F${i + 1}`,
56+
col7: `G${i + 1}`,
57+
col8: `H${i + 1}`,
58+
});
59+
}
60+
this.tableData = data;
61+
},
62+
},
63+
created() {
64+
this.initTableData();
65+
},
66+
};
67+
</script>
68+
```
69+
70+
:::
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:::tip
2+
1、表头默认是显示的,你可以用过 `:fixed-header="false"`隐藏表头
3+
:::
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div>
3+
<h2>表头隐藏</h2>
4+
<Explain />
5+
<Base />
6+
</div>
7+
</template>
8+
<script>
9+
import Explain from "./explain.md";
10+
import Base from "./base.md";
11+
12+
export default {
13+
name: "basic-main",
14+
components: {
15+
Explain,
16+
Base,
17+
},
18+
};
19+
</script>

examples/src/router/locale/en.router.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ const config = [
140140
name: "Header Grouping",
141141
meta: { keepAlive: true },
142142
},
143+
{
144+
path: "header-hidden",
145+
component: () =>
146+
import("@/docs/en/ve-table/header-hidden/main.vue"),
147+
name: "Header Hidden",
148+
meta: { keepAlive: true },
149+
},
143150
{
144151
path: "header-filter",
145152
component: () =>

0 commit comments

Comments
 (0)