Skip to content

Commit 2c1e8b5

Browse files
committed
doc refine
1 parent 4d7143a commit 2c1e8b5

File tree

5 files changed

+119
-3
lines changed

5 files changed

+119
-3
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
:::anchor 列宽拖动
2+
3+
:::demo 1、通过 `minWidth`设置列拖动的最小宽度<br>2、通过`sizeChange({ column, differWidth, columnWidth, tableWidth })`列拖动变化的回调信息
4+
5+
```html
6+
<template>
7+
<ve-table
8+
style="width:100%"
9+
:scroll-width="0"
10+
:columns="columns"
11+
:table-data="tableData"
12+
:border-around="true"
13+
:border-x="true"
14+
:border-y="true"
15+
:column-width-resize-option="columnWidthResizeOption"
16+
/>
17+
</template>
18+
19+
<script>
20+
export default {
21+
data() {
22+
return {
23+
columnWidthResizeOption: {
24+
// default false
25+
enable: true,
26+
// column resize min width
27+
minWidth: 30,
28+
// column size change
29+
sizeChange: ({ column, differWidth, columnWidth, tableWidth }) => {
30+
console.log("----------sizeChange----------");
31+
console.log("column::", column);
32+
console.log("differWidth::", differWidth);
33+
console.log("columnWidth::", columnWidth);
34+
console.log("tableWidth::", tableWidth);
35+
},
36+
},
37+
columns: [
38+
{
39+
field: "index",
40+
key: "index",
41+
title: "#",
42+
width: 50,
43+
align: "center",
44+
fixed: "left",
45+
renderBodyCell: ({ row, column, rowIndex }, h) => {
46+
return ++rowIndex;
47+
},
48+
},
49+
{ field: "col1", key: "col1", title: "Col1" },
50+
{ field: "col2", key: "col2", title: "Col2" },
51+
{ field: "col3", key: "col3", title: "Col3" },
52+
{ field: "col4", key: "col4", title: "Col4" },
53+
{ field: "col5", key: "col5", title: "Col5" },
54+
{ field: "col6", key: "col6", title: "Col6" },
55+
],
56+
tableData: [],
57+
};
58+
},
59+
methods: {
60+
initTableData() {
61+
let data = [];
62+
for (let i = 0; i < 8; i++) {
63+
data.push({
64+
rowKey: i,
65+
col1: `A${i + 1}`,
66+
col2: `B${i + 1}`,
67+
col3: `C${i + 1}`,
68+
col4: `D${i + 1}`,
69+
col5: `E${i + 1}`,
70+
col6: `F${i + 1}`,
71+
col7: `G${i + 1}`,
72+
col8: `H${i + 1}`,
73+
});
74+
}
75+
this.tableData = data;
76+
},
77+
},
78+
created() {
79+
this.initTableData();
80+
},
81+
};
82+
</script>
83+
```
84+
85+
:::
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:::tip
2+
1、Column width resize is useful when large text exists<br>
3+
2、Configure the column width resize through `columnWidthResizeOption`<br>
4+
3、It is recommended to set `scroll-width=0`, then dragging the column width will change the table width
5+
:::
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+
<Basic />
6+
</div>
7+
</template>
8+
<script>
9+
import Explain from "./explain.md";
10+
import Basic from "./basic.md";
11+
12+
export default {
13+
name: "basic-main",
14+
components: {
15+
Explain,
16+
Basic,
17+
},
18+
};
19+
</script>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
:::tip
2-
1、当存在大文本时,列宽调整将会很方便<br>
3-
2、通过`columnWidthResizeOption`设置列宽拖动行为<br>
4-
3、建议设置`scroll-width=0`列宽拖动将会改变表格宽度
2+
1、当存在大文本时,列宽调整将会很有用<br>
3+
2、通过`columnWidthResizeOption`设置列宽拖动功能<br>
4+
3、建议设置`scroll-width=0`那么列宽拖动将会改变表格宽度
55
:::

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ const config = [
112112
name: "Column Width",
113113
meta: { keepAlive: true },
114114
},
115+
{
116+
path: "column-resize",
117+
component: () =>
118+
import("@/docs/en/ve-table/column-resize/main.vue"),
119+
name: "Column Resize",
120+
meta: { keepAlive: true },
121+
},
115122
{
116123
path: "column-fixed",
117124
component: () =>

0 commit comments

Comments
 (0)