Skip to content

Commit c76ed7f

Browse files
committed
add scrollTo API
1 parent 7a26d7a commit c76ed7f

File tree

10 files changed

+190
-4
lines changed

10 files changed

+190
-4
lines changed

examples/src/docs/en/ve-table/api/column-props/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
},
2525
desc: {
2626
type: String,
27-
default: "columns",
27+
default: "Columns",
2828
},
2929
},
3030
data() {

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,51 @@ const columnsType1 = [
5353
},
5454
];
5555

56+
// 列配置类型2(应用于实例方法)
57+
const columnsType2 = [
58+
// {
59+
// key: "a",
60+
// field: "param",
61+
// title: "参数",
62+
// width: "10%",
63+
// align: "left",
64+
// type: "expand",
65+
// renderBodyCell: ({ row, column, rowIndex }, h) => {
66+
// return <span domPropsInnerHTML={row.param}></span>;
67+
// },
68+
// },
69+
{
70+
key: "b",
71+
field: "name",
72+
title: "方法名",
73+
width: "10%",
74+
align: "left",
75+
renderBodyCell: ({ row, column, rowIndex }, h) => {
76+
return <span domPropsInnerHTML={row.name}></span>;
77+
},
78+
},
79+
{
80+
key: "c",
81+
field: "desc",
82+
title: "说明",
83+
width: "70%",
84+
align: "left",
85+
renderBodyCell: ({ row, column, rowIndex }, h) => {
86+
return <span domPropsInnerHTML={row.desc}></span>;
87+
},
88+
},
89+
{
90+
key: "d",
91+
field: "param",
92+
title: "参数",
93+
width: "20%",
94+
align: "left",
95+
renderBodyCell: ({ row, column, rowIndex }, h) => {
96+
return <span domPropsInnerHTML={row.param}></span>;
97+
},
98+
},
99+
];
100+
56101
export const db = {
57102
// table props option
58103
table: {
@@ -413,6 +458,18 @@ export const db = {
413458
},
414459
},
415460

461+
// instance methods
462+
instanceMethods: {
463+
data: [
464+
{
465+
name: "scrollTop",
466+
desc: `Scrolls the table to the specified position`,
467+
param: "Refer to <a href='https://developer.mozilla.org/zh-CN/docs/Web/API/Element/scrollTo'> MDN scrollTo</a>",
468+
},
469+
],
470+
columns: columnsType2,
471+
},
472+
416473
// 可展开配置
417474
expandOption: {
418475
data: [
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div>
3+
<tpl
4+
:desc="desc"
5+
:anchor="anchor"
6+
:table-data="db.instanceMethods.data"
7+
:columns="db.instanceMethods.columns"
8+
/>
9+
</div>
10+
</template>
11+
<script>
12+
import tpl from "@/comp/api-tpl";
13+
import { db } from "./db";
14+
export default {
15+
components: { tpl },
16+
props: {
17+
anchor: {
18+
type: String,
19+
default: "Table Instance Methods",
20+
},
21+
desc: {
22+
type: String,
23+
default: "Table Instance Methods",
24+
},
25+
},
26+
data() {
27+
return {
28+
db: db,
29+
};
30+
},
31+
};
32+
</script>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TableProps />
66
<!-- columns -->
77
<ColumnProps />
8+
<!-- instance methods -->
9+
<InstanceMethods />
810
<!-- cell Span Option -->
911
<CellSpanOption />
1012
<!-- cell Style Option -->
@@ -31,6 +33,7 @@
3133
import { db } from "./db";
3234
import TableProps from "./table-props";
3335
import ColumnProps from "./column-props";
36+
import InstanceMethods from "./instance-methods";
3437
import ExpandOption from "./expand-option-props";
3538
import CheckboxOption from "./checkbox-option-props";
3639
import RadioOption from "./radio-option-props";
@@ -45,6 +48,7 @@ export default {
4548
components: {
4649
TableProps,
4750
ColumnProps,
51+
InstanceMethods,
4852
CellSpanOption,
4953
EventCustomOption,
5054
CellStyleOption,

examples/src/docs/en/ve-table/api/table-props.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
},
2121
desc: {
2222
type: String,
23-
default: "Table props",
23+
default: "Table Props",
2424
},
2525
},
2626
data() {

examples/src/docs/zh/ve-table/api/column-props/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default {
2424
},
2525
desc: {
2626
type: String,
27-
default: "columns",
27+
default: "Columns",
2828
},
2929
},
3030
data() {

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

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,51 @@ const columnsType1 = [
5353
},
5454
];
5555

56+
// 列配置类型2(应用于实例方法)
57+
const columnsType2 = [
58+
// {
59+
// key: "a",
60+
// field: "param",
61+
// title: "参数",
62+
// width: "10%",
63+
// align: "left",
64+
// type: "expand",
65+
// renderBodyCell: ({ row, column, rowIndex }, h) => {
66+
// return <span domPropsInnerHTML={row.param}></span>;
67+
// },
68+
// },
69+
{
70+
key: "b",
71+
field: "name",
72+
title: "方法名",
73+
width: "10%",
74+
align: "left",
75+
renderBodyCell: ({ row, column, rowIndex }, h) => {
76+
return <span domPropsInnerHTML={row.name}></span>;
77+
},
78+
},
79+
{
80+
key: "c",
81+
field: "desc",
82+
title: "说明",
83+
width: "70%",
84+
align: "left",
85+
renderBodyCell: ({ row, column, rowIndex }, h) => {
86+
return <span domPropsInnerHTML={row.desc}></span>;
87+
},
88+
},
89+
{
90+
key: "d",
91+
field: "param",
92+
title: "参数",
93+
width: "20%",
94+
align: "left",
95+
renderBodyCell: ({ row, column, rowIndex }, h) => {
96+
return <span domPropsInnerHTML={row.param}></span>;
97+
},
98+
},
99+
];
100+
56101
export const db = {
57102
// table props option
58103
table: {
@@ -413,6 +458,18 @@ export const db = {
413458
},
414459
},
415460

461+
// instance methods
462+
instanceMethods: {
463+
data: [
464+
{
465+
name: "scrollTop",
466+
desc: `使表格滚动到指定的位置`,
467+
param: "参考<a href='https://developer.mozilla.org/zh-CN/docs/Web/API/Element/scrollTo'> MDN scrollTo</a>",
468+
},
469+
],
470+
columns: columnsType2,
471+
},
472+
416473
// 可展开配置
417474
expandOption: {
418475
data: [
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div>
3+
<tpl
4+
:desc="desc"
5+
:anchor="anchor"
6+
:table-data="db.instanceMethods.data"
7+
:columns="db.instanceMethods.columns"
8+
/>
9+
</div>
10+
</template>
11+
<script>
12+
import tpl from "@/comp/api-tpl";
13+
import { db } from "./db";
14+
export default {
15+
components: { tpl },
16+
props: {
17+
anchor: {
18+
type: String,
19+
default: "实例方法",
20+
},
21+
desc: {
22+
type: String,
23+
default: "Table Instance Methods",
24+
},
25+
},
26+
data() {
27+
return {
28+
db: db,
29+
};
30+
},
31+
};
32+
</script>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
<TableProps />
66
<!-- columns -->
77
<ColumnProps />
8+
<!-- instance methods -->
9+
<InstanceMethods />
810
<!-- cell Span Option -->
911
<CellSpanOption />
1012
<!-- cell Style Option -->
@@ -31,6 +33,7 @@
3133
import { db } from "./db";
3234
import TableProps from "./table-props";
3335
import ColumnProps from "./column-props";
36+
import InstanceMethods from "./instance-methods";
3437
import ExpandOption from "./expand-option-props";
3538
import CheckboxOption from "./checkbox-option-props";
3639
import RadioOption from "./radio-option-props";
@@ -45,6 +48,7 @@ export default {
4548
components: {
4649
TableProps,
4750
ColumnProps,
51+
InstanceMethods,
4852
CellSpanOption,
4953
EventCustomOption,
5054
CellStyleOption,

examples/src/docs/zh/ve-table/api/table-props.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
},
2121
desc: {
2222
type: String,
23-
default: "Table props",
23+
default: "Table Props",
2424
},
2525
},
2626
data() {

0 commit comments

Comments
 (0)