Browse Source

dialog 遮罩功能

master_hella_20240701
陈薪名 8 months ago
parent
commit
0076db342b
  1. 4
      src/components/BasicForm/src/BasicForm.vue
  2. 31
      src/components/Dialog/src/Dialog.vue

4
src/components/BasicForm/src/BasicForm.vue

@ -4,8 +4,9 @@
v-model="dialogVisible" v-model="dialogVisible"
:width="dialogWidth" :width="dialogWidth"
:close-on-click-modal="false" :close-on-click-modal="false"
v-loading="formLoading" :vLoading="formLoading"
> >
<div <div
style="max-height: 60vh;overflow-y: auto;"> style="max-height: 60vh;overflow-y: auto;">
<Form <Form
@ -106,6 +107,7 @@
<template #footer> <template #footer>
<ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" /> <ButtonBase :Butttondata="Butttondata" @button-base-click="buttonBaseClick" />
</template> </template>
</Dialog> </Dialog>
<SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" /> <SearchTable ref="searchTableRef" @searchTableSuccess="searchTableSuccess" />
</template> </template>

31
src/components/Dialog/src/Dialog.vue

@ -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-loadingsvg使
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">

Loading…
Cancel
Save