From 36b6c31824849a114ae2816222d4e6534c840609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?0o=E5=BC=A0=E4=B8=8D=E6=AD=AAo0?= Date: Tue, 28 Jun 2022 13:22:33 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(component):=20layer=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=20full\min\restore=20=E4=B8=89=E7=A7=8D=E5=9B=9E?= =?UTF-8?q?=E8=B0=83=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #I5C2OK --- package/document-layer/src/document/zh-CN/demo.md | 5 ++++- package/layer/src/component/index.vue | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package/document-layer/src/document/zh-CN/demo.md b/package/document-layer/src/document/zh-CN/demo.md index 864f6fe6..668f758a 100644 --- a/package/document-layer/src/document/zh-CN/demo.md +++ b/package/document-layer/src/document/zh-CN/demo.md @@ -191,7 +191,10 @@ const openMaxmin = function() { type: 1, title: "标题", maxmin: true, - content: "内容" + content: "内容", + full:(e)=>{console.log('full',e)}, + min:(e)=>{console.log('min',e)}, + restore:(e)=>{console.log('restore',e)} }) } diff --git a/package/layer/src/component/index.vue b/package/layer/src/component/index.vue index ad19893f..5bacad76 100644 --- a/package/layer/src/component/index.vue +++ b/package/layer/src/component/index.vue @@ -90,6 +90,9 @@ export interface LayModalProps { appContext?: any; startIndex?: number; imgList?: { src: string; alt: string }[]; + min?: Function; + full?: Function; + restore?: Function; } const props = withDefaults(defineProps(), { @@ -115,6 +118,9 @@ const props = withDefaults(defineProps(), { destroy: () => { }, success: () => { }, end: () => { }, + full: () => { }, + min: () => { }, + restore: () => { }, yesText: "确定", isFunction: false, isMessage: false, @@ -224,6 +230,7 @@ const maxHandle = () => { h.value = _h.value; t.value = _t.value; l.value = _l.value; + props.restore(props.id) } else { _t.value = t.value; _l.value = l.value; @@ -233,6 +240,7 @@ const maxHandle = () => { h.value = maxArea().h; t.value = maxOffset().t; l.value = maxOffset().l; + props.full(props.id) } max.value = !max.value; }; @@ -251,6 +259,7 @@ const minHandle = () => { h.value = _h.value; t.value = _t.value; l.value = _l.value; + props.restore(props.id) } else { _w.value = w.value; _h.value = h.value; @@ -260,6 +269,7 @@ const minHandle = () => { w.value = minArea().w; t.value = minOffset(left).t; l.value = minOffset(left).l; + props.min(props.id) } min.value = !min.value; }; @@ -420,7 +430,7 @@ const styles = computed(() => { } if (offset.value[0].indexOf('%') > -1 || offset.value[1].indexOf('%') > -1) { // @ts-ignore - style.transform = `translate(-${style.left.indexOf('%')>-1?style.left:0},-${style.top.indexOf('%')>-1?style.top:0})`; + style.transform = `translate(-${style.left.indexOf('%') > -1 ? style.left : 0},-${style.top.indexOf('%') > -1 ? style.top : 0})`; } }