Skip to content

Commit 6fe2257

Browse files
committed
refine table width example
1 parent edbd64f commit 6fe2257

File tree

3 files changed

+62
-1
lines changed

3 files changed

+62
-1
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
:::anchor Auto Width
2+
3+
:::demo If the table width is not set, it is equivalent to `style="width:100%;"`
4+
5+
```html
6+
<template>
7+
<ve-table :columns="columns" :table-data="tableData" />
8+
</template>
9+
10+
<script>
11+
export default {
12+
data() {
13+
return {
14+
columns: [
15+
{ field: "name", key: "a", title: "Name", width: 100 },
16+
{ field: "date", key: "b", title: "Tel", width: 200 },
17+
{ field: "hobby", key: "c", title: "Hobby", width: 300 },
18+
{ field: "address", key: "d", title: "Address", width: 300 },
19+
],
20+
tableData: [
21+
{
22+
name: "John",
23+
date: "1900-05-20",
24+
hobby: "coding and coding repeat",
25+
address: "No.1 Century Avenue, Shanghai",
26+
},
27+
{
28+
name: "Dickerson",
29+
date: "1910-06-20",
30+
hobby: "coding and coding repeat",
31+
address: "No.1 Century Avenue, Beijing",
32+
},
33+
{
34+
name: "Larsen",
35+
date: "2000-07-20",
36+
hobby: "coding and coding repeat",
37+
address: "No.1 Century Avenue, Chongqing",
38+
},
39+
{
40+
name: "Geneva",
41+
date: "2010-08-20",
42+
hobby: "coding and coding repeat",
43+
address: "No.1 Century Avenue, Xiamen",
44+
},
45+
{
46+
name: "Jami",
47+
date: "2020-09-20",
48+
hobby: "coding and coding repeat",
49+
address: "No.1 Century Avenue, Shenzhen",
50+
},
51+
],
52+
};
53+
},
54+
};
55+
</script>
56+
```
57+
58+
:::

examples/src/docs/en/ve-table/table-width/main.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
<div>
33
<h2>Table Width</h2>
44
<Explain />
5+
<AutoWidth />
56
<FixedWidth />
67
<CalcWidth />
78
<PercentWidth />
89
</div>
910
</template>
1011
<script>
1112
import Explain from "./explain.md";
13+
import AutoWidth from "./auto-width.md";
1214
import FixedWidth from "./fixed-width.md";
1315
import CalcWidth from "./calc-width.md";
1416
import PercentWidth from "./percent-width.md";
@@ -17,6 +19,7 @@ export default {
1719
name: "basic-main",
1820
components: {
1921
Explain,
22+
AutoWidth,
2023
FixedWidth,
2124
CalcWidth,
2225
PercentWidth,

examples/src/docs/en/ve-table/table-width/percent-width.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:::anchor 表格动态宽度(百分比)
1+
:::anchor Dynamic Table Width(percentage)
22

33
:::demo 1、You can use percentage values to achieve a fixed width of the table. like `style="width:80%"`<br>2、Try changing the browser width to see the effect
44

0 commit comments

Comments
 (0)