|
@@ -55,6 +55,7 @@
|
|
watchEffect,
|
|
watchEffect,
|
|
toRef,
|
|
toRef,
|
|
getCurrentInstance,
|
|
getCurrentInstance,
|
|
|
|
+ nextTick,
|
|
} from 'vue';
|
|
} from 'vue';
|
|
|
|
|
|
import Modal from './components/Modal';
|
|
import Modal from './components/Modal';
|
|
@@ -68,6 +69,7 @@
|
|
|
|
|
|
import { basicProps } from './props';
|
|
import { basicProps } from './props';
|
|
import { useFullScreen } from './hooks/useModalFullScreen';
|
|
import { useFullScreen } from './hooks/useModalFullScreen';
|
|
|
|
+
|
|
import { omit } from 'lodash-es';
|
|
import { omit } from 'lodash-es';
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'BasicModal',
|
|
name: 'BasicModal',
|
|
@@ -79,12 +81,21 @@
|
|
const visibleRef = ref(false);
|
|
const visibleRef = ref(false);
|
|
const propsRef = ref<Partial<ModalProps> | null>(null);
|
|
const propsRef = ref<Partial<ModalProps> | null>(null);
|
|
const modalWrapperRef = ref<ComponentRef>(null);
|
|
const modalWrapperRef = ref<ComponentRef>(null);
|
|
|
|
+
|
|
// modal Bottom and top height
|
|
// modal Bottom and top height
|
|
const extHeightRef = ref(0);
|
|
const extHeightRef = ref(0);
|
|
const modalMethods: ModalMethods = {
|
|
const modalMethods: ModalMethods = {
|
|
setModalProps,
|
|
setModalProps,
|
|
emitVisible: undefined,
|
|
emitVisible: undefined,
|
|
|
|
+ redoModalHeight: () => {
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ if (unref(modalWrapperRef)) {
|
|
|
|
+ (unref(modalWrapperRef) as any).setModalHeight();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
};
|
|
};
|
|
|
|
+
|
|
const instance = getCurrentInstance();
|
|
const instance = getCurrentInstance();
|
|
if (instance) {
|
|
if (instance) {
|
|
emit('register', modalMethods, instance.uid);
|
|
emit('register', modalMethods, instance.uid);
|
|
@@ -135,6 +146,11 @@
|
|
(v) => {
|
|
(v) => {
|
|
emit('visible-change', v);
|
|
emit('visible-change', v);
|
|
instance && modalMethods.emitVisible?.(v, instance.uid);
|
|
instance && modalMethods.emitVisible?.(v, instance.uid);
|
|
|
|
+ nextTick(() => {
|
|
|
|
+ if (props.scrollTop && v && unref(modalWrapperRef)) {
|
|
|
|
+ (unref(modalWrapperRef) as any).scrollTop();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
{
|
|
{
|
|
immediate: false,
|
|
immediate: false,
|