chore(Popup): adjust shared props (#8224)

This commit is contained in:
neverland
2021-02-26 10:33:55 +08:00
committed by GitHub
parent cb6276451e
commit 87b6654900
6 changed files with 59 additions and 50 deletions
+4 -40
View File
@@ -1,4 +1,3 @@
// Utils
import {
ref,
watch,
@@ -9,10 +8,12 @@ import {
Transition,
onActivated,
CSSProperties,
TeleportProps,
onDeactivated,
} from 'vue';
import { createNamespace, isDef, UnknownProp } from '../utils';
// Utils
import { popupSharedProps } from './shared';
import { createNamespace, isDef } from '../utils';
// Composition
import { useEventListener } from '@vant/use';
@@ -36,43 +37,6 @@ const [createComponent, bem] = createNamespace('popup');
let globalZIndex = 2000;
export const popupSharedProps = {
// whether to show popup
show: Boolean,
// z-index
zIndex: [Number, String],
// transition duration
duration: [Number, String],
// teleport
teleport: [String, Object] as PropType<TeleportProps['to']>,
// overlay custom style
overlayStyle: Object as PropType<CSSProperties>,
// overlay custom class name
overlayClass: UnknownProp,
// Initial rendering animation
transitionAppear: Boolean,
// whether to show overlay
overlay: {
type: Boolean,
default: true,
},
// prevent body scroll
lockScroll: {
type: Boolean,
default: true,
},
// whether to lazy render
lazyRender: {
type: Boolean,
default: true,
},
// whether to close popup when overlay is clicked
closeOnClickOverlay: {
type: Boolean,
default: true,
},
};
export default createComponent({
inheritAttrs: false,
+45
View File
@@ -0,0 +1,45 @@
import { PropType, CSSProperties, TeleportProps } from 'vue';
import { UnknownProp } from '../utils';
export const popupSharedProps = {
// whether to show popup
show: Boolean,
// z-index
zIndex: [Number, String],
// transition duration
duration: [Number, String],
// teleport
teleport: [String, Object] as PropType<TeleportProps['to']>,
// overlay custom style
overlayStyle: Object as PropType<CSSProperties>,
// overlay custom class name
overlayClass: UnknownProp,
// Initial rendering animation
transitionAppear: Boolean,
// whether to show overlay
overlay: {
type: Boolean,
default: true,
},
// prevent body scroll
lockScroll: {
type: Boolean,
default: true,
},
// whether to lazy render
lazyRender: {
type: Boolean,
default: true,
},
// whether to close popup when overlay is clicked
closeOnClickOverlay: {
type: Boolean,
default: true,
},
};
export type PopupSharedPropKeys = Array<keyof typeof popupSharedProps>;
export const popupSharedPropKeys = Object.keys(
popupSharedProps
) as PopupSharedPropKeys;