diff --git a/src/css/layer.css b/src/css/layer.css index ff67b79da9dab94d9fc71160d43b970bcc69498d..ce7f6c1b4a1c6a8c5f3e7e6a00a9be2d219473de 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 29e838e9e7b1eeb8ed27a8294c02a4e317ab3fc3..1e1904dde1ed9a141546942ffac9459f3c012f23 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,12 +93,27 @@ const props = withDefaults(defineProps(), { isMessage: false, }); +// 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(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); // 位置属性 @@ -136,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 = () => { @@ -218,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); }); } } @@ -241,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', @@ -265,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' : '', ]" > -