43 lines
1.4 KiB
Vue
43 lines
1.4 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue'
|
|
import { dialogTitleOf, modalLayoutSpec } from './modal-model'
|
|
|
|
/**
|
|
* ModalShell 居中模态容器(module 13 task 248):封装 el-dialog,统一 admin 尺寸/圆角
|
|
* 与关闭语义,标题透传给 Element 默认头部;body 用默认槽、操作区走 footer 槽。
|
|
*/
|
|
const props = withDefaults(
|
|
defineProps<{ modelValue: boolean; title?: string; subtitle?: string; width?: string | number }>(),
|
|
{ title: '', subtitle: '', width: modalLayoutSpec().width },
|
|
)
|
|
const emit = defineEmits<{ (e: 'update:modelValue', value: boolean): void }>()
|
|
|
|
const visible = computed({
|
|
get: () => props.modelValue,
|
|
set: (v: boolean) => emit('update:modelValue', v),
|
|
})
|
|
const spec = computed(() => modalLayoutSpec())
|
|
const head = computed(() => dialogTitleOf({ title: props.title, subtitle: props.subtitle }))
|
|
</script>
|
|
|
|
<template>
|
|
<el-dialog
|
|
v-model="visible"
|
|
:width="width"
|
|
:title="head.title"
|
|
:close-on-click-modal="spec.maskClosable"
|
|
:close-on-press-escape="spec.escClosable"
|
|
class="admin-modal-shell"
|
|
>
|
|
<p v-if="head.subtitle" class="admin-modal-subtitle">{{ head.subtitle }}</p>
|
|
<slot />
|
|
<template #footer>
|
|
<slot name="footer" />
|
|
</template>
|
|
</el-dialog>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.admin-modal-subtitle { margin: 0 0 12px; color: var(--admin-muted); font-size: 13px; }
|
|
</style>
|