| | |
| | | <template> |
| | | <ScrollContainer ref="wrapperRef" :style="wrapStyle"> |
| | | <ScrollContainer ref="wrapperRef"> |
| | | <div ref="spinRef" :style="spinStyle" v-loading="loading" :loading-tip="loadingTip"> |
| | | <slot /> |
| | | </div> |
| | |
| | | |
| | | export default defineComponent({ |
| | | name: 'ModalWrapper', |
| | | inheritAttrs: false, |
| | | components: { Spin, ScrollContainer }, |
| | | props: { |
| | | loading: propTypes.bool, |
| | |
| | | const realHeightRef = ref(0); |
| | | const minRealHeightRef = ref(0); |
| | | |
| | | let realHeight = 0; |
| | | |
| | | let stopElResizeFn: Fn = () => {}; |
| | | |
| | | useWindowSizeFn(setModalHeight); |
| | |
| | | redoModalHeight: setModalHeight, |
| | | }); |
| | | |
| | | const wrapStyle = computed( |
| | | (): CSSProperties => { |
| | | return { |
| | | minHeight: `${props.minHeight}px`, |
| | | height: `${unref(realHeightRef)}px`, |
| | | // overflow: 'auto', |
| | | }; |
| | | } |
| | | ); |
| | | |
| | | const spinStyle = computed( |
| | | (): CSSProperties => { |
| | | return { |
| | | minHeight: `${props.minHeight}px`, |
| | | // padding 28 |
| | | height: `${unref(realHeightRef) - 28}px`, |
| | | }; |
| | |
| | | |
| | | if (!spinEl) return; |
| | | |
| | | const realHeight = spinEl.scrollHeight; |
| | | |
| | | if (!realHeight) { |
| | | realHeight = spinEl.scrollHeight; |
| | | } |
| | | if (props.fullScreen) { |
| | | realHeightRef.value = |
| | | window.innerHeight - props.modalFooterHeight - props.modalHeaderHeight; |
| | |
| | | ? props.height |
| | | : realHeight > maxHeight |
| | | ? maxHeight |
| | | : realHeight + 16 + 30; |
| | | : realHeight + 46; |
| | | } |
| | | emit('height-change', unref(realHeightRef)); |
| | | } catch (error) { |
| | |
| | | } |
| | | } |
| | | |
| | | return { wrapStyle, wrapperRef, spinRef, spinStyle }; |
| | | return { wrapperRef, spinRef, spinStyle }; |
| | | }, |
| | | }); |
| | | </script> |