From b5d0fec61183b25a98998ed5b2e2de5039ef2b51 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 9 Feb 2022 14:56:44 +0800 Subject: [PATCH] types: fix ts errors in demo files (#10275) * types: fix ts errors in demo files * docs: upd --- packages/vant-cli/site/desktop/components/Header.vue | 2 +- packages/vant/src/contact-edit/README.md | 5 ++++- packages/vant/src/contact-edit/README.zh-CN.md | 5 ++++- packages/vant/src/contact-edit/demo/index.vue | 7 +++++-- packages/vant/src/count-down/demo/index.vue | 3 +-- packages/vant/src/count-down/test/index.spec.tsx | 9 ++++++--- packages/vant/src/notify/demo/index.vue | 3 +-- packages/vant/src/slider/demo/index.vue | 4 ++-- packages/vant/src/stepper/demo/index.vue | 2 +- packages/vant/src/sticky/demo/index.vue | 2 +- packages/vant/src/swipe-cell/demo/index.vue | 6 ++++-- packages/vant/src/tab/demo/index.vue | 2 +- packages/vant/src/uploader/test/index.spec.ts | 2 +- packages/vant/src/uploader/types.ts | 2 +- 14 files changed, 33 insertions(+), 21 deletions(-) diff --git a/packages/vant-cli/site/desktop/components/Header.vue b/packages/vant-cli/site/desktop/components/Header.vue index 175482753..0501ff13d 100644 --- a/packages/vant-cli/site/desktop/components/Header.vue +++ b/packages/vant-cli/site/desktop/components/Header.vue @@ -262,7 +262,7 @@ export default { &__subtitle { display: inline-block; color: #999; - margin-left: 8px; + margin-left: 4px; vertical-align: -4px; font-size: 13px; } diff --git a/packages/vant/src/contact-edit/README.md b/packages/vant/src/contact-edit/README.md index f0571c6d7..2f3446c53 100644 --- a/packages/vant/src/contact-edit/README.md +++ b/packages/vant/src/contact-edit/README.md @@ -37,7 +37,10 @@ import { Toast } from 'vant'; export default { setup() { - const editingContact = ref({}); + const editingContact = ref({ + tel: '', + name: '', + }); const onSave = (contactInfo) => Toast('Save'); const onDelete = (contactInfo) => Toast('Delete'); return { diff --git a/packages/vant/src/contact-edit/README.zh-CN.md b/packages/vant/src/contact-edit/README.zh-CN.md index 6b19dcf7b..4409314aa 100644 --- a/packages/vant/src/contact-edit/README.zh-CN.md +++ b/packages/vant/src/contact-edit/README.zh-CN.md @@ -37,7 +37,10 @@ import { Toast } from 'vant'; export default { setup() { - const editingContact = ref({}); + const editingContact = ref({ + tel: '', + name: '', + }); const onSave = (contactInfo) => Toast('保存'); const onDelete = (contactInfo) => Toast('删除'); return { diff --git a/packages/vant/src/contact-edit/demo/index.vue b/packages/vant/src/contact-edit/demo/index.vue index 7e36f7ee8..23405172c 100644 --- a/packages/vant/src/contact-edit/demo/index.vue +++ b/packages/vant/src/contact-edit/demo/index.vue @@ -1,6 +1,6 @@ diff --git a/packages/vant/src/stepper/demo/index.vue b/packages/vant/src/stepper/demo/index.vue index 33db318de..b28273b29 100644 --- a/packages/vant/src/stepper/demo/index.vue +++ b/packages/vant/src/stepper/demo/index.vue @@ -42,7 +42,7 @@ const disabledInput = ref(1); const beforeChange = () => { Toast.loading({ forbidClick: true }); - return new Promise((resolve) => { + return new Promise((resolve) => { setTimeout(() => { Toast.clear(); resolve(true); diff --git a/packages/vant/src/sticky/demo/index.vue b/packages/vant/src/sticky/demo/index.vue index 4b77033ac..2e8e3a4d0 100644 --- a/packages/vant/src/sticky/demo/index.vue +++ b/packages/vant/src/sticky/demo/index.vue @@ -17,7 +17,7 @@ const t = useTranslate({ }, }); -const container = ref(null); +const container = ref();