11import { Drawer , Row , Col , Button } from 'ant-design-vue' ;
2- import {
3- defineComponent ,
4- ref ,
5- computed ,
6- watchEffect ,
7- watch ,
8- unref ,
9- // getCurrentInstance,
10- nextTick ,
11- toRaw ,
12- } from 'vue' ;
2+ import { defineComponent , ref , computed , watchEffect , watch , unref , nextTick , toRaw } from 'vue' ;
133import { BasicTitle } from '/@/components/Basic' ;
14- // import { ScrollContainer, ScrollContainerOptions } from '/@/components/Container/index';
154import { FullLoading } from '/@/components/Loading/index' ;
165
176import { getSlot } from '/@/utils/helper/tsxHelper' ;
@@ -21,8 +10,6 @@ import { DrawerInstance, DrawerProps } from './types';
2110import { basicProps } from './props' ;
2211import { isFunction , isNumber } from '/@/utils/is' ;
2312import { LeftOutlined } from '@ant-design/icons-vue' ;
24- // import { appStore } from '/@/store/modules/app';
25- // import { useRouter } from 'vue-router';
2613import { buildUUID } from '/@/utils/uuid' ;
2714import { deepMerge } from '/@/utils' ;
2815import './index.less' ;
@@ -38,7 +25,6 @@ export default defineComponent({
3825 const visibleRef = ref ( false ) ;
3926 const propsRef = ref < Partial < DrawerProps > | null > ( null ) ;
4027
41- // 自定义title组件:获得title
4228 const getMergeProps = computed ( ( ) : any => {
4329 return deepMerge ( toRaw ( props ) , unref ( propsRef ) ) ;
4430 } ) ;
@@ -68,9 +54,11 @@ export default defineComponent({
6854 }
6955 return opt ;
7056 } ) ;
57+
7158 watchEffect ( ( ) => {
7259 visibleRef . value = props . visible ;
7360 } ) ;
61+
7462 watch (
7563 ( ) => visibleRef . value ,
7664 ( visible ) => {
@@ -83,6 +71,15 @@ export default defineComponent({
8371 }
8472 ) ;
8573
74+ // 底部按钮自定义实现,
75+ const getFooterHeight = computed ( ( ) => {
76+ const { footerHeight, showFooter } : DrawerProps = unref ( getProps ) ;
77+ if ( showFooter && footerHeight ) {
78+ return isNumber ( footerHeight ) ? `${ footerHeight } px` : `${ footerHeight . replace ( 'px' , '' ) } px` ;
79+ }
80+ return `0px` ;
81+ } ) ;
82+
8683 // 取消事件
8784 async function onClose ( e : any ) {
8885 const { closeFunc } = unref ( getProps ) ;
@@ -103,14 +100,6 @@ export default defineComponent({
103100 }
104101 }
105102
106- // 底部按钮自定义实现,
107- const getFooterHeight = computed ( ( ) => {
108- const { footerHeight, showFooter } : DrawerProps = unref ( getProps ) ;
109- if ( showFooter && footerHeight ) {
110- return isNumber ( footerHeight ) ? `${ footerHeight } px` : `${ footerHeight . replace ( 'px' , '' ) } px` ;
111- }
112- return `0px` ;
113- } ) ;
114103 function renderFooter ( ) {
115104 const {
116105 showCancelBtn,
@@ -171,11 +160,13 @@ export default defineComponent({
171160 ) }
172161 </ Col >
173162 ) }
163+
174164 { title && (
175165 < Col style = "flex:1" class = { [ `${ prefixCls } __detail-title` , 'ellipsis' , 'px-2' ] } >
176166 { ( ) => title }
177167 </ Col >
178168 ) }
169+
179170 { getSlot ( slots , 'titleToolbar' ) }
180171 </ >
181172 ) }
@@ -208,22 +199,22 @@ export default defineComponent({
208199 title : ( ) => renderHeader ( ) ,
209200 default : ( ) => (
210201 < >
211- < FullLoading
212- absolute
213- class = { [ ! unref ( getProps ) . loading ? 'hidden' : '' ] }
214- tip = "加载中..."
215- />
216202 < div
217203 ref = { scrollRef }
218204 { ...attrs }
219- data-id = "123"
220205 style = { {
206+ position : 'relative' ,
221207 height : `calc(100% - ${ footerHeight } )` ,
222208 overflow : 'auto' ,
223209 padding : '16px' ,
224210 paddingBottom : '30px' ,
225211 } }
226212 >
213+ < FullLoading
214+ absolute
215+ tip = "加载中..."
216+ class = { [ ! unref ( getProps ) . loading ? 'hidden' : '' ] }
217+ />
227218 { getSlot ( slots , 'default' ) }
228219 </ div >
229220 { renderFooter ( ) }
0 commit comments