Skip to content

Commit ce767f2

Browse files
committed
doc: update demo ts type
1 parent b25c5cc commit ce767f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+89
-75
lines changed

components/button/demo/multiple.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ 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';
3738
import { defineComponent } from 'vue';
3839
export default defineComponent({
3940
components: {
4041
DownOutlined,
4142
},
4243
setup() {
43-
const handleMenuClick = (e: Event) => {
44+
const handleMenuClick: MenuProps['onClick'] = e => {
4445
console.log('click', e);
4546
};
4647
return {

components/button/demo/size.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,15 @@ If a large or small button is desired, set the `size` property to either `large`
6464
</template>
6565
<script lang="ts">
6666
import { DownloadOutlined } from '@ant-design/icons-vue';
67+
import type { SizeType } from 'ant-design-vue/es/config-provider';
6768
import { defineComponent, ref } from 'vue';
6869
export default defineComponent({
6970
components: {
7071
DownloadOutlined,
7172
},
7273
setup() {
7374
return {
74-
size: ref('large'),
75+
size: ref<SizeType>('large'),
7576
};
7677
},
7778
});

components/carousel/demo/position.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ There are 4 position options available.
3131
</template>
3232
<script lang="ts">
3333
import { defineComponent, ref } from 'vue';
34+
import type { CarouselProps } from 'ant-design-vue';
3435
3536
export default defineComponent({
3637
setup() {
3738
return {
38-
dotPosition: ref('top'),
39+
dotPosition: ref<CarouselProps['dotPosition']>('top'),
3940
};
4041
},
4142
});

components/cascader/demo/custom-trigger.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default defineComponent({
7272
const value = ref<string[]>([]);
7373
const text = ref<string>('Unselect');
7474
75-
const onChange = (value: string, selectedOptions: Option[]) => {
75+
const onChange = (_value: string, selectedOptions: Option[]) => {
7676
text.value = selectedOptions.map(o => o.label).join(', ');
7777
};
7878

components/collapse/demo/extra.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ More than one panel can be expanded at a time, the first panel is initialized to
4141
<script lang="ts">
4242
import { SettingOutlined } from '@ant-design/icons-vue';
4343
import { defineComponent, ref, watch } from 'vue';
44+
import type { CollapseProps } from 'ant-design-vue';
4445
4546
export default defineComponent({
4647
components: {
@@ -49,7 +50,7 @@ export default defineComponent({
4950
setup() {
5051
const text = `A dog is a type of domesticated animal.Known for its loyalty and faithfulness,it can be found as a welcome guest in many households across the world.`;
5152
const activeKey = ref(['1']);
52-
const expandIconPosition = ref('left');
53+
const expandIconPosition = ref<CollapseProps['expandIconPosition']>('left');
5354
5455
const handleClick = (event: MouseEvent) => {
5556
// If you don't want click extra trigger collapse, you can prevent this:

components/date-picker/demo/bordered.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ export default defineComponent({
4141
value3: ref<Dayjs>(),
4242
value4: ref<Dayjs>(),
4343
value5: ref<Dayjs>(),
44-
value6: ref<Dayjs[]>([]),
45-
value7: ref<Dayjs[]>([]),
46-
value8: ref<Dayjs[]>([]),
47-
value9: ref<Dayjs[]>([]),
44+
value6: ref<[Dayjs, Dayjs]>(),
45+
value7: ref<[Dayjs, Dayjs]>(),
46+
value8: ref<[Dayjs, Dayjs]>(),
47+
value9: ref<[Dayjs, Dayjs]>(),
4848
};
4949
},
5050
});

components/descriptions/demo/size.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,11 @@ Custom sizes to fit in a variety of containers.
6767
</template>
6868
<script lang="ts">
6969
import { defineComponent, ref } from 'vue';
70-
// TODO
71-
import type { RadioChangeEvent } from 'ant-design-vue/es/radio/interface';
72-
70+
import type { DescriptionsProps } from 'ant-design-vue';
7371
export default defineComponent({
7472
setup() {
75-
const size = ref('default');
76-
const onChange = (e: RadioChangeEvent) => {
73+
const size = ref<DescriptionsProps['size']>('default');
74+
const onChange = (e: any) => {
7775
console.log('size checked', e.target.value);
7876
size.value = e.target.value;
7977
};

components/descriptions/demo/vertical.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<docs>
22
---
33
order: 4
4-
title:
4+
title:
55
zh-CN: 垂直
66
en-US: Vertical
77
---
@@ -21,7 +21,7 @@ Simplest Usage.
2121
<a-descriptions-item label="UserName">Zhou Maomao</a-descriptions-item>
2222
<a-descriptions-item label="Telephone">1810000000</a-descriptions-item>
2323
<a-descriptions-item label="Live">Hangzhou, Zhejiang</a-descriptions-item>
24-
<a-descriptions-item label="Address" span="2">
24+
<a-descriptions-item label="Address" :span="2">
2525
No. 18, Wantang Road, Xihu District, Hangzhou, Zhejiang, China
2626
</a-descriptions-item>
2727
<a-descriptions-item label="Remark">empty</a-descriptions-item>

components/drawer/demo/extra.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ Extra actions should be placed at corner of drawer in Ant Design, you can using
4242
</template>
4343
<script lang="ts">
4444
import { defineComponent, ref } from 'vue';
45+
import type { DrawerProps } from 'ant-design-vue';
4546
export default defineComponent({
4647
setup() {
47-
const placement = ref<string>('left');
48+
const placement = ref<DrawerProps['placement']>('left');
4849
const visible = ref<boolean>(false);
4950
5051
const showDrawer = () => {

components/drawer/demo/form-in-drawer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Use form in drawer with submit button.
8080
<a-date-picker
8181
v-model:value="form.dateTime"
8282
style="width: 100%"
83-
:get-popup-container="trigger => trigger.parentNode"
83+
:get-popup-container="trigger => trigger.parentElement"
8484
/>
8585
</a-form-item>
8686
</a-col>
@@ -117,7 +117,7 @@ export default defineComponent({
117117
owner: '',
118118
type: '',
119119
approver: '',
120-
dateTime: '',
120+
dateTime: null,
121121
description: '',
122122
});
123123

0 commit comments

Comments
 (0)