From 2664e941fe27bda965323e09cc70ade9094ae226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0o=E5=BC=A0=E4=B8=8D=E6=AD=AAo0?= Date: Thu, 30 Jun 2022 21:46:04 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F:=20=E5=AE=8C=E5=96=84layer.n?= =?UTF-8?q?otify()=E5=85=A5=E5=9C=BA=E5=8A=A8=E7=94=BB,=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E4=BE=9D=E8=B5=96anim=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package/layer/src/component/index.vue | 4 ++++ package/layer/src/index.ts | 1 - package/layer/src/theme/index.css | 1 + package/layer/src/utils/index.ts | 24 +++++++++++++++--------- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/package/layer/src/component/index.vue b/package/layer/src/component/index.vue index 3f8baf8d..e54e6dee 100644 --- a/package/layer/src/component/index.vue +++ b/package/layer/src/component/index.vue @@ -39,6 +39,7 @@ import { calculatePhotosArea, calculateNotifOffset, removeNotifiyFromQueen, + getNotifyAnimationClass, } from "../utils"; import useMove from "../composable/useMove"; import useResize from "../composable/useResize"; @@ -530,6 +531,9 @@ const enterActiveClass = computed(() => { if (type === 4) { return getDrawerAnimationClass(props.offset); } + if (type === 6) { + return getNotifyAnimationClass(props.offset); + } return `layer-anim layer-anim-0${props.anim}`; }); diff --git a/package/layer/src/index.ts b/package/layer/src/index.ts index 755ec979..9e257c84 100644 --- a/package/layer/src/index.ts +++ b/package/layer/src/index.ts @@ -140,7 +140,6 @@ const layer = { }, //通知 notifiy: (option: any = {}, callback?: Function) => { - option.anim = 5; option.shade = false; option.type = 6; let defaultOption = { diff --git a/package/layer/src/theme/index.css b/package/layer/src/theme/index.css index 9f8baa01..503fea51 100644 --- a/package/layer/src/theme/index.css +++ b/package/layer/src/theme/index.css @@ -1282,4 +1282,5 @@ html #layuicss-layer { display: inline-block; transform: scale(0.7); margin-left: -7px; + margin-right: 3px; } \ No newline at end of file diff --git a/package/layer/src/utils/index.ts b/package/layer/src/utils/index.ts index 1294c9c7..c3ba477b 100644 --- a/package/layer/src/utils/index.ts +++ b/package/layer/src/utils/index.ts @@ -344,9 +344,7 @@ export function removeNotifiyFromQueen(layerId: string | undefined) { // 间隙 let transOffsetTop = 15; // @ts-ignore 删除项的高度 - let offsetHeight = - document.getElementById(layerId)?.firstElementChild?.firstElementChild - ?.offsetHeight; + let offsetHeight = document.getElementById(layerId)?.firstElementChild?.firstElementChild?.offsetHeight; // @ts-ignore window.NotifiyQueen = window.NotifiyQueen || []; // @ts-ignore @@ -366,17 +364,25 @@ export function removeNotifiyFromQueen(layerId: string | undefined) { ?.firstElementChild; if (offsetType === "rt" || offsetType === "lt") { // @ts-ignore - dom.style["top"] = - parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px"; + dom.style["top"] = parseFloat(dom.style["top"]) - transOffsetTop - offsetHeight + "px"; } else { // @ts-ignore - let bottom = - parseFloat(dom.style["top"].split(" - ")[1]) - - transOffsetTop - - offsetHeight; + let bottom = parseFloat(dom.style["top"].split(" - ")[1]) - transOffsetTop - offsetHeight; // @ts-ignore dom.style["top"] = "calc(100vh - " + bottom + "px)"; } }); notifiyQueen.splice(index, 1); //删除 } + +// Notify动画类 +export function getNotifyAnimationClass(offset: any) { + const prefix = "layer-drawer-anim layer-anim"; + let suffix = ""; + if (offset === "lt" || offset === "lb") { + suffix = "lr"; + } else { + suffix = "rl"; + } + return `${prefix}-${suffix}`; +} \ No newline at end of file