Skip to content

Commit da0d4e7

Browse files
committed
add doc
1 parent e3b24a2 commit da0d4e7

File tree

6 files changed

+37
-248
lines changed

6 files changed

+37
-248
lines changed

examples/src/docs/zh/ve-table/contextmenu/base.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
:::anchor 基础用法
22

3+
右键表格区域查看效果
4+
35
:::demo
46

57
```html
@@ -136,18 +138,6 @@
136138
methods: {},
137139
};
138140
</script>
139-
<style>
140-
#contextmenu-container {
141-
display: flex;
142-
width: 300px;
143-
height: 300px;
144-
justify-content: center;
145-
align-items: center;
146-
background: #eee;
147-
border: 3px dashed #666;
148-
border-radius: 8px;
149-
}
150-
</style>
151141
```
152142

153143
:::
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:::anchor 右键菜单功能分类
2+
3+
这些右键菜单功能你可以随意选择和组合
4+
5+
| 功能 | 类型 |
6+
| :----------- | :----------------- |
7+
| 分割线 | `SEPARATOR` |
8+
| 在上方插入行 | `INSERT_ROW_ABOVE` |
9+
| 在下方插入行 | `INSERT_ROW_BELOW` |
10+
| 移除该行 | `REMOVE_ROW` |
11+
| 隐藏该行 | `HIDE_COLUMN` |

examples/src/docs/zh/ve-table/contextmenu/custom.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@
2525
contextmenuBodyOption: {
2626
// callback for all options
2727
callback: ({ type, selection }) => {
28+
const { rowKey, colKey } = selection;
29+
30+
const rowIndex = this.tableData.findIndex((x) => x.rowKey === rowKey);
31+
32+
// custom empty row
33+
if (type === "custom-empty-row") {
34+
this.tableData = this.tableData.map((rowData) => {
35+
// empty current row
36+
if (rowData.rowKey === rowKey) {
37+
this.columns.forEach((column) => {
38+
rowData[column.field] = "";
39+
});
40+
}
41+
return rowData;
42+
});
43+
}
44+
2845
console.log("type::", type);
2946
console.log("selection::", selection);
3047
},
@@ -41,10 +58,8 @@
4158
type: "SEPARATOR",
4259
},
4360
{
44-
type: "REMOVE_ROW",
45-
},
46-
{
47-
type: "SEPARATOR",
61+
type: "custom-empty-row",
62+
label: "empty row(custom)",
4863
},
4964
{
5065
type: "customType1",
@@ -167,18 +182,6 @@
167182
methods: {},
168183
};
169184
</script>
170-
<style>
171-
#contextmenu-container {
172-
display: flex;
173-
width: 300px;
174-
height: 300px;
175-
justify-content: center;
176-
align-items: center;
177-
background: #eee;
178-
border: 3px dashed #666;
179-
border-radius: 8px;
180-
}
181-
</style>
182185
```
183186

184187
:::

examples/src/docs/zh/ve-table/contextmenu/disbled.md

Lines changed: 0 additions & 219 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
:::tip
2-
1、待完善
2+
1、有些操作可以通过右键菜单更方便的完成。比如单元格编辑功能,可以通过右键操作很方便的插入行或者移除行<br>
3+
2、当然你也可以自定义右键菜单功能
34
:::

examples/src/docs/zh/ve-table/contextmenu/main.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22
<div>
33
<h2>右键菜单</h2>
44
<Explain />
5+
<ContextmenuTypes />
56
<Base />
67
<Custom />
78
</div>
89
</template>
910
<script>
1011
import Explain from "./explain.md";
12+
import ContextmenuTypes from "./contextmenu-types.md";
1113
import Base from "./base.md";
1214
import Custom from "./custom.md";
1315
1416
export default {
1517
name: "basic-main",
1618
components: {
1719
Explain,
20+
ContextmenuTypes,
1821
Base,
1922
Custom,
2023
},

0 commit comments

Comments
 (0)