types(Popup): add PopupInstance prop (#10062)

* types(Popup): add PopupInstance prop

* docs: update
This commit is contained in:
neverland 2021-12-18 11:08:27 +08:00 committed by GitHub
parent 0002f1b1af
commit 56b210156e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 11 deletions

View File

@ -35,13 +35,8 @@ import { POPUP_TOGGLE_KEY } from '../composables/on-popup-reopen';
import { Icon } from '../icon'; import { Icon } from '../icon';
import { Overlay } from '../overlay'; import { Overlay } from '../overlay';
export type PopupPosition = 'top' | 'left' | 'bottom' | 'right' | 'center' | ''; // Types
import type { PopupPosition, PopupCloseIconPosition } from './types';
export type PopupCloseIconPosition =
| 'top-left'
| 'top-right'
| 'bottom-left'
| 'bottom-right';
const popupProps = extend({}, popupSharedProps, { const popupProps = extend({}, popupSharedProps, {
round: Boolean, round: Boolean,

View File

@ -151,7 +151,12 @@ Use `teleport` prop to specify mount location.
The component exports the following type definitions: The component exports the following type definitions:
```ts ```ts
import type { PopupProps, PopupPosition, PopupCloseIconPosition } from 'vant'; import type {
PopupProps,
PopupPosition,
PopupInstance,
PopupCloseIconPosition,
} from 'vant';
``` ```
## Theming ## Theming

View File

@ -157,7 +157,12 @@ export default {
组件导出以下类型定义: 组件导出以下类型定义:
```ts ```ts
import type { PopupProps, PopupPosition, PopupCloseIconPosition } from 'vant'; import type {
PopupProps,
PopupPosition,
PopupInstance,
PopupCloseIconPosition,
} from 'vant';
``` ```
## 主题定制 ## 主题定制

View File

@ -3,8 +3,9 @@ import _Popup from './Popup';
export const Popup = withInstall(_Popup); export const Popup = withInstall(_Popup);
export default Popup; export default Popup;
export type { PopupProps } from './Popup';
export type { export type {
PopupProps,
PopupPosition, PopupPosition,
PopupInstance,
PopupCloseIconPosition, PopupCloseIconPosition,
} from './Popup'; } from './types';

View File

@ -0,0 +1,12 @@
import type { ComponentPublicInstance } from 'vue';
import type { PopupProps } from './Popup';
export type PopupPosition = 'top' | 'left' | 'bottom' | 'right' | 'center' | '';
export type PopupCloseIconPosition =
| 'top-left'
| 'top-right'
| 'bottom-left'
| 'bottom-right';
export type PopupInstance = ComponentPublicInstance<PopupProps>;