Skip to content

Commit 10fed70

Browse files
committed
doc: update demo ts error
1 parent 239354e commit 10fed70

File tree

11 files changed

+59
-164
lines changed

11 files changed

+59
-164
lines changed

components/button/demo/multiple.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ If you need several buttons, we recommend that you use 1 primary button + n seco
3434
</template>
3535
<script lang="ts">
3636
import { DownOutlined } from '@ant-design/icons-vue';
37-
import { MenuProps } from 'ant-design-vue';
37+
import type { MenuProps } from 'ant-design-vue';
3838
import { defineComponent } from 'vue';
3939
export default defineComponent({
4040
components: {

components/dropdown/demo/overlay-visible.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The default is to close the menu when you click on menu items, this feature can
3434
<script lang="ts">
3535
import { defineComponent, ref } from 'vue';
3636
import { DownOutlined } from '@ant-design/icons-vue';
37-
import { MenuProps } from 'ant-design-vue';
37+
import type { MenuProps } from 'ant-design-vue';
3838
3939
export default defineComponent({
4040
components: {

components/modal/__tests__/__snapshots__/Modal.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exports[`Modal render correctly 1`] = `
2626

2727
exports[`Modal render correctly 2`] = `
2828
<div>
29-
<div></div>
29+
<div style="overflow: hidden; overflow-x: hidden; overflow-y: hidden;" class="ant-scrolling-effect"></div>
3030
<div class="ant-modal-root">
3131
<div class="ant-modal-mask"></div>
3232
<div tabindex="-1" class="ant-modal-wrap" role="dialog">

components/table/demo/sticky.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ For long table,need to scroll to view the header and scroll bar,then you can
3434
</template>
3535

3636
<script lang="ts">
37+
import type { TableColumnsType } from 'ant-design-vue';
3738
import { defineComponent, ref } from 'vue';
3839
3940
export default defineComponent({
4041
setup() {
41-
const columns = ref([
42+
const columns = ref<TableColumnsType>([
4243
{
4344
title: 'Full Name',
4445
width: 100,

components/tabs/demo/editable-card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Only card type Tabs support adding & closable.
1919

2020
<template>
2121
<a-tabs v-model:activeKey="activeKey" type="editable-card" @edit="onEdit">
22-
<a-tab-pane v-for="pane in panes" :key="pane.key" :tab="pane.title" :closable="!!pane.closable">
22+
<a-tab-pane v-for="pane in panes" :key="pane.key" :tab="pane.title" :closable="pane.closable">
2323
{{ pane.content }}
2424
</a-tab-pane>
2525
</a-tabs>

components/transfer/demo/tree-transfer.vue

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ Customize render list with Tree component.
5151
</template>
5252
<script lang="ts">
5353
import { computed, defineComponent, ref } from 'vue';
54-
import type { TreeProps } from 'ant-design-vue';
54+
import type { TransferProps, TreeProps } from 'ant-design-vue';
5555
import type { AntTreeNodeCheckedEvent } from 'ant-design-vue/es/tree';
56-
const tData: TreeProps['treeData'] = [
56+
const tData: TransferProps['dataSource'] = [
5757
{ key: '0-0', title: '0-0' },
5858
{
5959
key: '0-1',
@@ -66,8 +66,8 @@ const tData: TreeProps['treeData'] = [
6666
{ key: '0-2', title: '0-3' },
6767
];
6868
69-
const transferDataSource: TreeProps['treeData'] = [];
70-
function flatten(list: TreeProps['treeData'] = []) {
69+
const transferDataSource: TransferProps['dataSource'] = [];
70+
function flatten(list: TransferProps['dataSource'] = []) {
7171
list.forEach(item => {
7272
transferDataSource.push(item);
7373
flatten(item.children);
@@ -79,26 +79,23 @@ function isChecked(selectedKeys: (string | number)[], eventKey: string | number)
7979
return selectedKeys.indexOf(eventKey) !== -1;
8080
}
8181
82-
function handleTreeData(
83-
data: TreeProps['treeData'],
84-
targetKeys: string[] = [],
85-
): TreeProps['treeData'] {
82+
function handleTreeData(data: TransferProps['dataSource'], targetKeys: string[] = []) {
8683
data.forEach(item => {
8784
item['disabled'] = targetKeys.includes(item.key as any);
8885
if (item.children) {
8986
handleTreeData(item.children, targetKeys);
9087
}
9188
});
92-
return data;
89+
return data as TreeProps['treeData'];
9390
}
9491
9592
export default defineComponent({
9693
setup() {
9794
const targetKeys = ref<string[]>([]);
9895
99-
const dataSource = ref<TreeProps['treeData']>(transferDataSource);
96+
const dataSource = ref(transferDataSource);
10097
101-
const treeData = computed<TreeProps['treeData']>(() => {
98+
const treeData = computed(() => {
10299
return handleTreeData(tData, targetKeys.value);
103100
});
104101

components/tree/demo/dynamic.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export default defineComponent({
3838
{ title: 'Expand to load', key: '1' },
3939
{ title: 'Tree Node', key: '2', isLeaf: true },
4040
]);
41-
const onLoadData = (treeNode: any) => {
42-
return new Promise((resolve: (value?: unknown) => void) => {
41+
const onLoadData: TreeProps['loadData'] = treeNode => {
42+
return new Promise(resolve => {
4343
if (treeNode.dataRef.children) {
4444
resolve();
4545
return;

site/debugger/demo/demo.vue

Lines changed: 33 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -2,127 +2,55 @@
22
---
33
order: 0
44
title:
5-
en-US: Basic Usage
65
zh-CN: 基本用法
6+
en-US: Basic usage
77
---
88

99
## zh-CN
1010

11-
简单的表格,最后一列是各种操作
11+
第一个对话框
1212

1313
## en-US
1414

15-
Simple table with actions.
15+
Basic modal.
16+
1617
</docs>
1718

1819
<template>
19-
<a-table :columns="columns" :data-source="data">
20-
<template #headerCell="{ title, column }">
21-
<template v-if="column.key === 'name'">
22-
<span>
23-
<smile-outlined />
24-
Name
25-
</span>
26-
</template>
27-
<template v-else>{{ title }}</template>
28-
</template>
29-
30-
<template #bodyCell="{ column, record }">
31-
<template v-if="column.key === 'name'">
32-
<a>
33-
{{ record.name }}
34-
</a>
35-
</template>
36-
<template v-else-if="column.key === 'tags'">
37-
<span>
38-
<a-tag
39-
v-for="tag in record.tags"
40-
:key="tag"
41-
:color="tag === 'loser' ? 'volcano' : tag.length > 5 ? 'geekblue' : 'green'"
42-
>
43-
{{ tag.toUpperCase() }}
44-
</a-tag>
45-
</span>
46-
</template>
47-
<template v-else-if="column.key === 'action'">
48-
<span>
49-
<a>Invite 一 {{ record.name }}</a>
50-
<a-divider type="vertical" />
51-
<a>Delete</a>
52-
<a-divider type="vertical" />
53-
<a class="ant-dropdown-link">
54-
More actions
55-
<down-outlined />
56-
</a>
57-
</span>
58-
</template>
59-
<template v-else>{{ record.name }}</template>
60-
</template>
61-
</a-table>
20+
<div>
21+
<div ref="container"></div>
22+
<a-button type="primary" @click="showModal">Open Modal</a-button>
23+
<a-modal v-model:visible="visible" title="Basic Modal" @ok="handleOk">
24+
<p>Some contents...</p>
25+
<p>Some contents...</p>
26+
<p>Some contents...</p>
27+
</a-modal>
28+
</div>
6229
</template>
6330
<script lang="ts">
64-
import { SmileOutlined, DownOutlined } from '@ant-design/icons-vue';
65-
import { defineComponent } from 'vue';
66-
const columns = [
67-
{
68-
name: 'Name',
69-
dataIndex: 'name',
70-
key: 'name',
71-
},
72-
{
73-
title: 'Age',
74-
dataIndex: 'age',
75-
key: 'age',
76-
},
77-
{
78-
title: 'Address',
79-
dataIndex: 'address',
80-
key: 'address',
81-
},
82-
{
83-
title: 'Tags',
84-
key: 'tags',
85-
dataIndex: 'tags',
86-
},
87-
{
88-
title: 'Action',
89-
key: 'action',
90-
},
91-
];
92-
93-
const data = [
94-
{
95-
key: '1',
96-
name: 'John Brown',
97-
age: 32,
98-
address: 'New York No. 1 Lake Park',
99-
tags: ['nice', 'developer'],
100-
},
101-
{
102-
key: '2',
103-
name: 'Jim Green',
104-
age: 42,
105-
address: 'London No. 1 Lake Park',
106-
tags: ['loser'],
107-
},
108-
{
109-
key: '3',
110-
name: 'Joe Black',
111-
age: 32,
112-
address: 'Sidney No. 1 Lake Park',
113-
tags: ['cool', 'teacher'],
114-
},
115-
];
116-
31+
import { defineComponent, ref } from 'vue';
11732
export default defineComponent({
118-
components: {
119-
SmileOutlined,
120-
DownOutlined,
121-
},
12233
setup() {
34+
const visible = ref<boolean>(false);
35+
36+
const showModal = () => {
37+
visible.value = true;
38+
};
39+
40+
const handleOk = (e: MouseEvent) => {
41+
console.log(e);
42+
visible.value = false;
43+
};
44+
const container = ref();
12345
return {
124-
data,
125-
columns,
46+
container,
47+
visible,
48+
showModal,
49+
handleOk,
50+
getContainer() {
51+
console.log('container', container.value);
52+
return container.value;
53+
},
12654
};
12755
},
12856
});

site/src/components/api.vue

Lines changed: 0 additions & 31 deletions
This file was deleted.

site/src/components/demoSort.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default defineComponent({
1010
},
1111
setup() {
1212
return {
13-
demoContext: inject('demoContext', {}),
1413
globalConfig: inject(GLOBAL_CONFIG),
1514
};
1615
},

0 commit comments

Comments
 (0)