From 4cb974ab025c14bc5766d6943a5ef0a32ad50928 Mon Sep 17 00:00:00 2001 From: neverland Date: Sun, 14 Feb 2021 17:07:26 +0800 Subject: [PATCH] types: ComponentInstance (#8154) --- src/area/index.tsx | 6 ++---- src/dialog/index.tsx | 12 +++--------- src/form/index.tsx | 9 +++------ src/password-input/demo/index.vue | 13 +++++++------ src/picker/index.tsx | 16 ++++++++++------ src/swipe/index.tsx | 18 +++++++++++------- src/utils/base.ts | 5 +++-- src/utils/validate/email.ts | 2 +- 8 files changed, 40 insertions(+), 41 deletions(-) diff --git a/src/area/index.tsx b/src/area/index.tsx index f65d511e8..5d121702f 100644 --- a/src/area/index.tsx +++ b/src/area/index.tsx @@ -7,12 +7,11 @@ import { nextTick, PropType, onMounted, - ComponentPublicInstance, } from 'vue'; // Utils import { deepClone } from '../utils/deep-clone'; -import { createNamespace, pick } from '../utils'; +import { pick, createNamespace, ComponentInstance } from '../utils'; // Composition import { useExpose } from '../composables/use-expose'; @@ -66,8 +65,7 @@ export default createComponent({ emits: ['change', 'confirm'], setup(props, { emit, slots }) { - // eslint-disable-next-line - const pickerRef = ref>(); + const pickerRef = ref(); const state = reactive({ code: props.value, diff --git a/src/dialog/index.tsx b/src/dialog/index.tsx index 9ac7ec1ba..1108be6cf 100644 --- a/src/dialog/index.tsx +++ b/src/dialog/index.tsx @@ -1,10 +1,5 @@ -import { - App, - CSSProperties, - TeleportProps, - ComponentPublicInstance, -} from 'vue'; -import { inBrowser } from '../utils'; +import { App, CSSProperties, TeleportProps } from 'vue'; +import { inBrowser, ComponentInstance } from '../utils'; import { Interceptor } from '../utils/interceptor'; import { mountComponent, usePopupState } from '../utils/mount-component'; import VanDialog, { @@ -38,8 +33,7 @@ export type DialogOptions = { closeOnClickOverlay?: boolean; }; -// eslint-disable-next-line -let instance: ComponentPublicInstance<{}, any>; +let instance: ComponentInstance; function initInstance() { const Wrapper = { diff --git a/src/form/index.tsx b/src/form/index.tsx index 97d15acde..a81a3dbd9 100644 --- a/src/form/index.tsx +++ b/src/form/index.tsx @@ -1,7 +1,7 @@ -import { ComponentPublicInstance, PropType } from 'vue'; +import { PropType } from 'vue'; // Utils -import { createNamespace } from '../utils'; +import { createNamespace, ComponentInstance } from '../utils'; // Composition import { useChildren } from '@vant/use'; @@ -46,10 +46,7 @@ export default createComponent({ emits: ['submit', 'failed'], setup(props, { emit, slots }) { - const { children, linkChildren } = useChildren< - // eslint-disable-next-line - ComponentPublicInstance<{}, any> - >(FORM_KEY); + const { children, linkChildren } = useChildren(FORM_KEY); const getFieldsByNames = (names?: string[]) => { if (names) { diff --git a/src/password-input/demo/index.vue b/src/password-input/demo/index.vue index 0224dcf90..113e772df 100644 --- a/src/password-input/demo/index.vue +++ b/src/password-input/demo/index.vue @@ -53,7 +53,8 @@