From e6e0d646628c3d5010e98439d0d670586e215ce2 Mon Sep 17 00:00:00 2001 From: Sight <7407590+wcg666@user.noreply.gitee.com> Date: Fri, 17 Dec 2021 03:09:19 +0000 Subject: [PATCH 1/2] =?UTF-8?q?1.=E5=85=BC=E5=AE=B9=E8=AF=AD=E4=B9=89?= =?UTF-8?q?=E5=8C=96=E7=B1=BB=E5=9E=8B=202.=E9=98=B2=E6=AD=A2=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=97=B6=E5=A4=8D=E5=88=B6title=E6=96=87=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/css/layer.css | 3 ++- src/module/modal/index.vue | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/css/layer.css b/src/css/layer.css index ff67b79..ce7f6c1 100644 --- a/src/css/layer.css +++ b/src/css/layer.css @@ -3,7 +3,8 @@ .layui-layer-tab .layui-layer-title span, .layui-layer-title { text-overflow: ellipsis; - white-space: nowrap + white-space: nowrap; + user-select:none; } html #layuicss-layer { diff --git a/src/module/modal/index.vue b/src/module/modal/index.vue index 29e838e..920eb03 100644 --- a/src/module/modal/index.vue +++ b/src/module/modal/index.vue @@ -46,7 +46,7 @@ export interface LayModalProps { btn?: Record[] | false; move?: boolean | string; resize?: boolean | string; - type?: 0 | 1 | 2 | 3; + type?: 0 | 1 | 2 | 3 | 'dialog' | 'component' | 'iframe' | 'loading'; content?: string; isHtmlFragment?: boolean; shade?: boolean | string; @@ -93,6 +93,20 @@ const props = withDefaults(defineProps(), { isMessage: false, }); +// 支持语义化类型 +const modalType = function() { + if(props.type === 'dialog'){ + props.type = 0; + }else if(props.type === 'component'){ + props.type = 1; + }else if(props.type === 'iframe'){ + props.type = 2; + }else if(props.type === 'loading'){ + props.type = 3; + } +}; +modalType(); + // 初始属性 const id = nextId(); const max = ref(false); -- Gitee From 783a96b0bd1240a55edcb35eb758f2e140a33649 Mon Sep 17 00:00:00 2001 From: Sight <7407590+wcg666@user.noreply.gitee.com> Date: Fri, 17 Dec 2021 05:09:26 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dmodal=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/module/modal/index.vue | 43 +++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/module/modal/index.vue b/src/module/modal/index.vue index 920eb03..1e1904d 100644 --- a/src/module/modal/index.vue +++ b/src/module/modal/index.vue @@ -93,26 +93,27 @@ const props = withDefaults(defineProps(), { isMessage: false, }); -// 支持语义化类型 -const modalType = function() { - if(props.type === 'dialog'){ - props.type = 0; - }else if(props.type === 'component'){ - props.type = 1; - }else if(props.type === 'iframe'){ - props.type = 2; - }else if(props.type === 'loading'){ - props.type = 3; +// modal 类型 +let type: number = 1; +const modalType = function(modalType: number | string) { + if(modalType === 'dialog' || modalType === 0 || modalType === '0'){ + type = 0; + }else if(modalType === 'component' || modalType === 1 || modalType === '1'){ + type = 1; + }else if(modalType === 'iframe' || modalType === 2 || modalType === '2'){ + type = 2; + }else if(modalType === 'loading' || modalType === 3 || modalType === '3'){ + type = 3; } }; -modalType(); +modalType(props.type); // 初始属性 const id = nextId(); const max = ref(false); const area: Ref = ref(calculateArea(props.area)); const offset: Ref = ref(calculateOffset(props.offset, area)); -const contentHeight = ref( calculateContent(area.value[1], props.btn, props.type)); +const contentHeight = ref( calculateContent(area.value[1], props.btn, type)); const visible = ref(props.modelValue); // 位置属性 @@ -150,7 +151,7 @@ watch(() => props.modelValue, () => { ); watch(max, () => { - contentHeight.value = calculateContent(h.value, props.btn, props.type); + contentHeight.value = calculateContent(h.value, props.btn, type); }); const shadeHandle = () => { @@ -232,7 +233,7 @@ const supportMove = function () { useMove(layero.value,(width, height) => { w.value = width; h.value = height; - contentHeight.value = calculateContent(h.value, props.btn, props.type); + contentHeight.value = calculateContent(h.value, props.btn, type); }); } } @@ -255,10 +256,10 @@ const supportMove = function () { :id="id" ref="layero" :class="[ - type === 0 || type === '0' ? 'layui-layer-dialog' : '', - type === 1 || type === '1' ? 'layui-layer-page' : '', - type === 2 || type === '2' ? 'layui-layer-iframe' : '', - type === 3 || type === '3' ? 'layui-layer-loading' : '', + type === 0 ? 'layui-layer-dialog' : '', + type === 1 ? 'layui-layer-page' : '', + type === 2 ? 'layui-layer-iframe' : '', + type === 3 ? 'layui-layer-loading' : '', isMessage ? 'layui-layer-msg' : '', isMessage && !icon ? 'layui-layer-hui' : '', 'layui-layer-border', @@ -279,11 +280,11 @@ const supportMove = function () { class="layui-layer-content" :style="{ height: contentHeight }" :class="[ - type === 3 || type === '3' ? `layui-layer-loading${load}` : '', + type === 3 ? `layui-layer-loading${load}` : '', icon ? 'layui-layer-padding' : '', ]" > -