|
@ -11,7 +11,8 @@ const props = defineProps({ |
|
|
fullscreen: propTypes.bool.def(true), |
|
|
fullscreen: propTypes.bool.def(true), |
|
|
width: propTypes.oneOfType([String, Number]).def('40%'), |
|
|
width: propTypes.oneOfType([String, Number]).def('40%'), |
|
|
scroll: propTypes.bool.def(false), // 是否开启滚动条。如果是的话,按照 maxHeight 设置最大高度 |
|
|
scroll: propTypes.bool.def(false), // 是否开启滚动条。如果是的话,按照 maxHeight 设置最大高度 |
|
|
maxHeight: propTypes.oneOfType([String, Number]).def('400px') |
|
|
maxHeight: propTypes.oneOfType([String, Number]).def('400px'), |
|
|
|
|
|
vLoading:propTypes.bool.def(false) |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const getBindValue = computed(() => { |
|
|
const getBindValue = computed(() => { |
|
@ -50,11 +51,38 @@ watch( |
|
|
} |
|
|
} |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
const demo = ref() |
|
|
|
|
|
watch( |
|
|
|
|
|
() => props.vLoading, |
|
|
|
|
|
async (val: boolean) => { |
|
|
|
|
|
await nextTick() |
|
|
|
|
|
if (val) { |
|
|
|
|
|
initDialog() |
|
|
|
|
|
} else { |
|
|
|
|
|
demo.close() |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
immediate: true |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
const dialogStyle = computed(() => { |
|
|
const dialogStyle = computed(() => { |
|
|
return { |
|
|
return { |
|
|
height: unref(dialogHeight) |
|
|
height: unref(dialogHeight) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const initDialog = () => { |
|
|
|
|
|
// 用服务生成一个el-loading实例,包括了自定义svg的指令如何在服务中使用 |
|
|
|
|
|
demo.value = ElLoading.service({ target: '.loading', text: '加载中...', background: 'rgba(246, 246, 246, 0.8)' }) |
|
|
|
|
|
// setTimeout(() => { |
|
|
|
|
|
// // 延时执行关闭,对应dom清除,如要再使用loading,需重新生成新实例 |
|
|
|
|
|
// demo.close() |
|
|
|
|
|
// }, 5000) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template> |
|
|
<template> |
|
@ -68,6 +96,7 @@ const dialogStyle = computed(() => { |
|
|
draggable |
|
|
draggable |
|
|
class="com-dialog" |
|
|
class="com-dialog" |
|
|
:show-close="false" |
|
|
:show-close="false" |
|
|
|
|
|
custom-class="loading" |
|
|
> |
|
|
> |
|
|
<template #header="{ close }"> |
|
|
<template #header="{ close }"> |
|
|
<div class="relative h-54px flex items-center justify-between pl-15px pr-15px"> |
|
|
<div class="relative h-54px flex items-center justify-between pl-15px pr-15px"> |
|
|