From 9bec4dcae002f36aa23231da11cb03a156b40110 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周三, 30 4月 2025 16:24:16 +0800 Subject: [PATCH] 222 --- PipeLineLems/web/src/components/BaseDrawer/BaseDrawer.tsx | 80 +++++++++++++++++++++++++-------------- 1 files changed, 51 insertions(+), 29 deletions(-) diff --git a/PipeLineLems/web/src/components/BaseDrawer/BaseDrawer.tsx b/PipeLineLems/web/src/components/BaseDrawer/BaseDrawer.tsx index 6917bed..e09feb3 100644 --- a/PipeLineLems/web/src/components/BaseDrawer/BaseDrawer.tsx +++ b/PipeLineLems/web/src/components/BaseDrawer/BaseDrawer.tsx @@ -1,6 +1,8 @@ -import { computed, defineComponent, onMounted, ref } from 'vue' +import { Component, computed, defineComponent, onMounted, ref } from 'vue' import styles from './BaseDrawer.module.scss' import Icon from '../Icon/Icon' +import { _t } from '@/libs/Language/Language' + //@ts-ignore export default defineComponent<{ [key: string]: any @@ -21,6 +23,15 @@ type: String, default: '', }, + submitDisabled: { + type: Boolean, + default: false, + }, + appendToBody: { + type: Boolean, + default: true, + }, + // modelValue: { // type: Boolean, // default: false, @@ -41,6 +52,43 @@ // }) return () => { + const vSlots: { + footer: () => Component + title?: () => Component + } = { + footer() { + return ( + <div class={styles.csDialogFooter}> + <el-button + onClick={() => emit('close')} + type="info" + plain + class={{ + [styles.dialogBtn]: true, + [styles.csBaseBtn]: true, + }} + > + {_t('鍙栨秷')} + </el-button> + <el-button + onClick={() => emit('confirm')} + type="primary" + disabled={props.submitDisabled} + class={{ + [styles.csBaseBtn]: true, + }} + > + {_t('纭')} + </el-button> + </div> + ) + }, + } + if (slots.title) { + vSlots.title = () => { + return slots.title?.() + } + } return ( <div class={styles.drawContent} @@ -55,34 +103,8 @@ }} onOpen={() => emit('open')} onClose={() => emit('close')} - v-slots={{ - footer() { - return ( - <div class={styles.csDialogFooter}> - <el-button - onClick={() => emit('close')} - type="info" - plain - class={{ - [styles.dialogBtn]: true, - [styles.csBaseBtn]: true, - }} - > - 鍙栨秷 - </el-button> - <el-button - onClick={() => emit('confirm')} - type="primary" - class={{ - [styles.csBaseBtn]: true, - }} - > - 纭 - </el-button> - </div> - ) - }, - }} + v-slots={vSlots} + append-to-body={props.appendToBody} {...attrs} title={props.title} size={props.width || attrs.size} -- Gitblit v1.9.3