mirror of
https://github.com/pure-admin/vue-pure-admin.git
synced 2025-12-15 14:50:29 +08:00
chore: ReDialog组件适配el-dialog最新版本的API变更以及补充相关示例 (#1236)
This commit is contained in:
@@ -35,8 +35,20 @@ type DialogProps = {
|
||||
top?: string;
|
||||
/** 是否需要遮罩层,默认 `true` */
|
||||
modal?: boolean;
|
||||
/** 是否允许穿透遮罩层,默认 `false`。使用时需将 `modal` 属性设置为 `false` */
|
||||
modalPenetrable?: boolean;
|
||||
/** 遮罩的自定义类名 */
|
||||
modalClass?: string;
|
||||
/** `header` 部分的自定义 `class` 名 */
|
||||
headerClass?: string;
|
||||
/** `body` 部分的自定义 `class` 名 */
|
||||
bodyClass?: string;
|
||||
/** `footer` 部分的自定义 `class` 名 */
|
||||
footerClass?: string;
|
||||
/** `Dialog` 自身是否插入至 `body` 元素上。嵌套的 `Dialog` 必须指定该属性并赋值为 `true`,默认 `false` */
|
||||
appendToBody?: boolean;
|
||||
/** `Dialog` 挂载到哪个 `DOM` 元素,该属性会覆盖 `append-to-body` 属性,默认 `body` */
|
||||
appendTo?: string | HTMLElement;
|
||||
/** 是否在 `Dialog` 出现时将 `body` 滚动锁定,默认 `true` */
|
||||
lockScroll?: boolean;
|
||||
/** `Dialog` 的自定义类名 */
|
||||
@@ -57,12 +69,22 @@ type DialogProps = {
|
||||
beforeClose?: (done: DoneFn) => void;
|
||||
/** 为 `Dialog` 启用可拖拽功能,默认 `false` */
|
||||
draggable?: boolean;
|
||||
/** 拖动范围可以超出可视区,默认 `false` */
|
||||
overflow?: boolean;
|
||||
/** 是否让 `Dialog` 的 `header` 和 `footer` 部分居中排列,默认 `false` */
|
||||
center?: boolean;
|
||||
/** 是否水平垂直对齐对话框,默认 `false` */
|
||||
alignCenter?: boolean;
|
||||
/** 当关闭 `Dialog` 时,销毁其中的元素,默认 `false` */
|
||||
destroyOnClose?: boolean;
|
||||
/** 自定义关闭图标,默认 `Close` */
|
||||
closeIcon?: string | Component;
|
||||
/** 和原生的 `CSS` 的 `z-index` 相同,改变 `z` 轴的顺序 */
|
||||
zIndex?: number;
|
||||
/** `header` 的 `aria-level` 属性 */
|
||||
headerAriaLevel?: string;
|
||||
/** 对话框动画的自定义过渡配置。可以是一个字符串(过渡名称),也可以是一个包含 `Vue` 过渡属性的对象,默认 `dialog-fade` */
|
||||
transition?: string | object;
|
||||
};
|
||||
|
||||
//element-plus.org/zh-CN/component/popconfirm.html#attributes
|
||||
|
||||
@@ -463,6 +463,16 @@ function onSureBtnLoading() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 自定义动画
|
||||
function onTransitionClick(title, transition) {
|
||||
addDialog({
|
||||
width: "30%",
|
||||
title,
|
||||
transition,
|
||||
contentRenderer: () => <p>{JSON.stringify(transition)}</p>
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -551,5 +561,112 @@ function onSureBtnLoading() {
|
||||
点击底部确定按钮可开启按钮动画
|
||||
</el-button>
|
||||
</el-space>
|
||||
<el-divider />
|
||||
<el-space wrap>
|
||||
<el-button
|
||||
@click="onTransitionClick('淡入淡出动画(默认)', 'dialog-fade')"
|
||||
>
|
||||
淡入淡出动画(默认)
|
||||
</el-button>
|
||||
<el-button @click="onTransitionClick('缩放动画', 'dialog-scale')">
|
||||
缩放动画
|
||||
</el-button>
|
||||
<el-button @click="onTransitionClick('滑动动画', 'dialog-slide')">
|
||||
滑动动画
|
||||
</el-button>
|
||||
<el-button @click="onTransitionClick('弹跳动画', 'dialog-bounce')">
|
||||
弹跳动画
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="
|
||||
onTransitionClick('自定义动画事件处理器(可配置对象)', {
|
||||
name: 'dialog-custom-object',
|
||||
appear: true,
|
||||
mode: 'out-in',
|
||||
duration: 500
|
||||
})
|
||||
"
|
||||
>
|
||||
自定义动画事件处理器(可配置对象)
|
||||
</el-button>
|
||||
</el-space>
|
||||
</el-card>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* Scale Animation */
|
||||
.dialog-scale-enter-active,
|
||||
.dialog-scale-leave-active,
|
||||
.dialog-scale-enter-active .el-dialog,
|
||||
.dialog-scale-leave-active .el-dialog {
|
||||
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||
}
|
||||
|
||||
.dialog-scale-enter-from,
|
||||
.dialog-scale-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.dialog-scale-enter-from .el-dialog,
|
||||
.dialog-scale-leave-to .el-dialog {
|
||||
opacity: 0;
|
||||
transform: scale(0.5);
|
||||
}
|
||||
|
||||
/* Slide Animation */
|
||||
.dialog-slide-enter-active,
|
||||
.dialog-slide-leave-active,
|
||||
.dialog-slide-enter-active .el-dialog,
|
||||
.dialog-slide-leave-active .el-dialog {
|
||||
transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
||||
}
|
||||
|
||||
.dialog-slide-enter-from,
|
||||
.dialog-slide-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.dialog-slide-enter-from .el-dialog,
|
||||
.dialog-slide-leave-to .el-dialog {
|
||||
opacity: 0;
|
||||
transform: translateY(-100px);
|
||||
}
|
||||
|
||||
/* Bounce Animation */
|
||||
.dialog-bounce-enter-active,
|
||||
.dialog-bounce-leave-active,
|
||||
.dialog-bounce-enter-active .el-dialog,
|
||||
.dialog-bounce-leave-active .el-dialog {
|
||||
transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
}
|
||||
|
||||
.dialog-bounce-enter-from,
|
||||
.dialog-bounce-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.dialog-bounce-enter-from .el-dialog,
|
||||
.dialog-bounce-leave-to .el-dialog {
|
||||
opacity: 0;
|
||||
transform: scale(0.3) translateY(-50px);
|
||||
}
|
||||
|
||||
/* Object Configuration Animation */
|
||||
.dialog-custom-object-enter-active,
|
||||
.dialog-custom-object-leave-active,
|
||||
.dialog-custom-object-enter-active .el-dialog,
|
||||
.dialog-custom-object-leave-active .el-dialog {
|
||||
transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
}
|
||||
|
||||
.dialog-custom-object-enter-from,
|
||||
.dialog-custom-object-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.dialog-custom-object-enter-from .el-dialog,
|
||||
.dialog-custom-object-leave-to .el-dialog {
|
||||
opacity: 0;
|
||||
transform: rotate(180deg) scale(0.5);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user