功能:更新消息中心和 YumiNail 模块
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<a-modal
|
||||
v-bind="$attrs"
|
||||
:open="open"
|
||||
:title="title"
|
||||
:width="mergedWidth"
|
||||
:centered="!isMobile"
|
||||
:wrap-class-name="isMobile ? 'admin-mobile-modal' : undefined"
|
||||
:style="mergedStyle"
|
||||
:body-style="mergedBodyStyle"
|
||||
@update:open="handleOpenChange"
|
||||
@cancel="handleCancel"
|
||||
@ok="handleOk"
|
||||
>
|
||||
<slot />
|
||||
<template v-if="$slots.footer" #footer>
|
||||
<slot name="footer" />
|
||||
</template>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { CSSProperties } from 'vue'
|
||||
import { computed } from 'vue'
|
||||
import { useAdminViewport } from '@/composables/useAdminViewport'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
open: boolean
|
||||
title?: string
|
||||
desktopWidth?: string | number
|
||||
mobileBodyPadding?: string
|
||||
}>(), {
|
||||
title: '',
|
||||
desktopWidth: 720,
|
||||
mobileBodyPadding: '16px 16px 104px'
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
(event: 'update:open', value: boolean): void
|
||||
(event: 'cancel', value?: unknown): void
|
||||
(event: 'ok', value?: unknown): void
|
||||
}>()
|
||||
|
||||
const { isMobile } = useAdminViewport()
|
||||
|
||||
const mergedWidth = computed(() => (isMobile.value ? '100vw' : props.desktopWidth))
|
||||
const mergedStyle = computed(() => (
|
||||
isMobile.value
|
||||
? {
|
||||
top: '0px',
|
||||
maxWidth: '100vw',
|
||||
paddingBottom: '0px'
|
||||
}
|
||||
: undefined
|
||||
))
|
||||
const mergedBodyStyle = computed(() => (
|
||||
isMobile.value
|
||||
? ({
|
||||
maxHeight: 'calc(100vh - 124px)',
|
||||
overflowY: 'auto',
|
||||
padding: props.mobileBodyPadding
|
||||
} as CSSProperties)
|
||||
: undefined
|
||||
))
|
||||
|
||||
const handleOpenChange = (value: boolean) => {
|
||||
emit('update:open', value)
|
||||
}
|
||||
|
||||
const handleCancel = (event?: unknown) => {
|
||||
emit('update:open', false)
|
||||
emit('cancel', event)
|
||||
}
|
||||
|
||||
const handleOk = (event?: unknown) => {
|
||||
emit('ok', event)
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user