perf:Dialog 组件增加top,width默认值,将maxHeight改为height

This commit is contained in:
ktianc 2023-07-05 09:36:18 +08:00
parent ee3b2f448e
commit 8c57536513
3 changed files with 11 additions and 12 deletions

View File

@ -9,12 +9,14 @@ const slots = useSlots()
const props = defineProps({
modelValue: propTypes.bool.def(false),
title: propTypes.string.def('Dialog'),
top: propTypes.string.def('8vh'),
fullscreen: propTypes.bool.def(true),
maxHeight: propTypes.oneOfType([String, Number]).def('500px')
height: propTypes.oneOfType([String, Number]).def('500px'),
width: propTypes.oneOfType([String, Number]).def('700px')
})
const getBindValue = computed(() => {
const delArr: string[] = ['fullscreen', 'title', 'maxHeight']
const delArr: string[] = ['fullscreen', 'title', 'height', 'top', 'width']
const attrs = useAttrs()
const obj = { ...attrs, ...props }
for (const key in obj) {
@ -31,7 +33,7 @@ const toggleFull = () => {
isFullscreen.value = !unref(isFullscreen)
}
const dialogHeight = ref(isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight)
const dialogHeight = ref(isNumber(props.height) ? `${props.height}px` : props.height)
watch(
() => isFullscreen.value,
@ -41,7 +43,7 @@ watch(
const windowHeight = document.documentElement.offsetHeight
dialogHeight.value = `${windowHeight - 55 - 60 - (slots.footer ? 63 : 0)}px`
} else {
dialogHeight.value = isNumber(props.maxHeight) ? `${props.maxHeight}px` : props.maxHeight
dialogHeight.value = isNumber(props.height) ? `${props.height}px` : props.height
}
},
{
@ -64,6 +66,8 @@ const dialogStyle = computed(() => {
lock-scroll
draggable
:close-on-click-modal="false"
:top="top"
:width="width"
>
<template #header>
<div class="flex justify-between">

View File

@ -196,7 +196,7 @@ watch(
</template>
</Table>
<Dialog v-model="dialogVisible" :title="dialogTitle" width="700px" maxHeight="600px">
<Dialog v-model="dialogVisible" :title="dialogTitle" width="700px" height="600px">
<Write
ref="writeRef"
:current-row="tableObject.currentRow"

View File

@ -367,12 +367,7 @@ const handleCommand = (command: string) => {
</template>
</Dialog>
<Dialog
v-model="importDialogVisible"
:title="importDialogTitle"
width="750px"
maxHeight="550px"
>
<Dialog v-model="importDialogVisible" :title="importDialogTitle" width="750px" height="550px">
<Import @get-list="getList" />
</Dialog>
@ -380,7 +375,7 @@ const handleCommand = (command: string) => {
v-model="passwordDialogVisible"
:title="passwordDialogTitle"
width="1000px"
maxHeight="550px"
height="550px"
>
<PasswordSendSMS
v-if="passwordDialogType === 'sms'"