chore: adjust popupSharedProps

This commit is contained in:
chenjiahan 2020-08-24 10:27:55 +08:00
parent 28f2fe340c
commit 00395f0146
4 changed files with 21 additions and 34 deletions

View File

@ -22,7 +22,7 @@ export default createComponent({
setup(props, { slots }) { setup(props, { slots }) {
useParent(ACTION_BAR_KEY, ref()); useParent(ACTION_BAR_KEY, ref());
function genIcon() { const renderIcon = () => {
const { dot, badge, icon, color, iconClass } = props; const { dot, badge, icon, color, iconClass } = props;
if (slots.icon) { if (slots.icon) {
@ -44,7 +44,7 @@ export default createComponent({
class={[bem('icon'), iconClass]} class={[bem('icon'), iconClass]}
/> />
); );
} };
return (vm) => ( return (vm) => (
<div <div
@ -55,7 +55,7 @@ export default createComponent({
route(vm.$router, vm); route(vm.$router, vm);
}} }}
> >
{genIcon()} {renderIcon()}
{slots.default ? slots.default() : props.text} {slots.default ? slots.default() : props.text}
</div> </div>
); );

View File

@ -8,8 +8,6 @@ export default createComponent({
...popupSharedProps, ...popupSharedProps,
color: String, color: String,
message: [Number, String], message: [Number, String],
duration: [Number, String],
teleport: [String, Object],
className: null, className: null,
background: String, background: String,
type: { type: {
@ -28,12 +26,12 @@ export default createComponent({
return ( return (
<Popup <Popup
show={props.show} show={props.show}
class={[bem([props.type]), props.className]}
style={style} style={style}
position="top"
overlay={false} overlay={false}
position="top"
duration={0.2} duration={0.2}
lockScroll={false} lockScroll={false}
class={[bem([props.type]), props.className]}
> >
{slots.default?.() || props.message} {slots.default?.() || props.message}
</Popup> </Popup>

View File

@ -26,18 +26,21 @@ const context = {
export const popupSharedProps = { export const popupSharedProps = {
// whether to show popup // whether to show popup
show: Boolean, show: Boolean,
// whether to show overlay // z-index
overlay: Boolean, zIndex: [Number, String],
// transition duration
duration: [Number, String],
// teleport
teleport: [String, Object],
// overlay custom style // overlay custom style
overlayStyle: Object, overlayStyle: Object,
// overlay custom class name // overlay custom class name
overlayClass: String, overlayClass: String,
// teleport // whether to show overlay
teleport: [String, Object], overlay: {
// whether to close popup when click overlay type: Boolean,
closeOnClickOverlay: Boolean, default: true,
// z-index },
zIndex: [Number, String],
// prevent body scroll // prevent body scroll
lockScroll: { lockScroll: {
type: Boolean, type: Boolean,
@ -48,6 +51,11 @@ export const popupSharedProps = {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
// whether to close popup when click overlay
closeOnClickOverlay: {
type: Boolean,
default: true,
},
}; };
export default createComponent({ export default createComponent({
@ -58,7 +66,6 @@ export default createComponent({
props: { props: {
...popupSharedProps, ...popupSharedProps,
round: Boolean, round: Boolean,
duration: [Number, String],
closeable: Boolean, closeable: Boolean,
transition: String, transition: String,
safeAreaInsetBottom: Boolean, safeAreaInsetBottom: Boolean,
@ -74,14 +81,6 @@ export default createComponent({
type: String, type: String,
default: 'center', default: 'center',
}, },
overlay: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
}, },
emits: [ emits: [

View File

@ -12,18 +12,12 @@ export default createComponent({
props: { props: {
...popupSharedProps, ...popupSharedProps,
title: String, title: String,
duration: [Number, String],
teleport: [String, Object],
cancelText: String, cancelText: String,
description: String, description: String,
options: { options: {
type: Array, type: Array,
default: () => [], default: () => [],
}, },
overlay: {
type: Boolean,
default: true,
},
closeOnPopstate: { closeOnPopstate: {
type: Boolean, type: Boolean,
default: true, default: true,
@ -32,10 +26,6 @@ export default createComponent({
type: Boolean, type: Boolean,
default: true, default: true,
}, },
closeOnClickOverlay: {
type: Boolean,
default: true,
},
}, },
emits: ['cancel', 'select', 'update:show', 'click-overlay'], emits: ['cancel', 'select', 'update:show', 'click-overlay'],