⚡优化组件zr-dialog
This commit is contained in:
parent
b827c47497
commit
9dfe258421
@ -1,13 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog v-bind="$attrs" :fullscreen="isFullscreen" ref="myDialogRef" v-model="open">
|
||||||
:width="width"
|
|
||||||
:title="title"
|
|
||||||
:lock-scroll="false"
|
|
||||||
v-model="open"
|
|
||||||
:lockScroll="lockScroll"
|
|
||||||
:fullscreen="isFullscreen"
|
|
||||||
:draggable="draggable"
|
|
||||||
@closed="close">
|
|
||||||
<template #header="{ close, titleId, titleClass }">
|
<template #header="{ close, titleId, titleClass }">
|
||||||
<div class="custom-header">
|
<div class="custom-header">
|
||||||
<span :id="titleId" :class="titleClass">{{ title }}</span>
|
<span :id="titleId" :class="titleClass">{{ title }}</span>
|
||||||
@ -16,9 +8,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<slot name="footer"> </slot>
|
<slot name="footer"> </slot>
|
||||||
</template>
|
</template>
|
||||||
@ -34,24 +24,11 @@ const props = defineProps({
|
|||||||
title: {
|
title: {
|
||||||
type: String
|
type: String
|
||||||
},
|
},
|
||||||
width: {
|
|
||||||
type: [Number, String],
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
fullScreen: {
|
fullScreen: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
|
||||||
draggable: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
lockScroll: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const isFullscreen = ref(false)
|
const isFullscreen = ref(false)
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
watch(
|
watch(
|
||||||
@ -69,13 +46,18 @@ watch(
|
|||||||
{ deep: true, immediate: true }
|
{ deep: true, immediate: true }
|
||||||
)
|
)
|
||||||
|
|
||||||
const emit = defineEmits()
|
|
||||||
function handleScreen() {
|
function handleScreen() {
|
||||||
isFullscreen.value = !isFullscreen.value
|
isFullscreen.value = !isFullscreen.value
|
||||||
}
|
}
|
||||||
function close() {
|
const expose = {}
|
||||||
emit('close')
|
const myDialogRef = ref()
|
||||||
}
|
onMounted(() => {
|
||||||
|
const entries = Object.entries(myDialogRef.value)
|
||||||
|
for (const [method, fn] of entries) {
|
||||||
|
expose[method] = fn
|
||||||
|
}
|
||||||
|
})
|
||||||
|
defineExpose(expose)
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
.custom-header {
|
.custom-header {
|
||||||
|
|||||||
@ -68,7 +68,7 @@
|
|||||||
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
<pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
<!-- 添加或修改公告对话框 -->
|
<!-- 添加或修改公告对话框 -->
|
||||||
<zr-dialog :title="title" v-model="open" width="780px" @close="cancel" fullScreen>
|
<zr-dialog :title="title" draggable v-model="open" width="580px">
|
||||||
<el-form ref="noticeRef" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="noticeRef" :model="form" :rules="rules" label-width="80px">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :lg="24">
|
<el-col :lg="24">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user