There seemed to be no use for that ?
This commit is contained in:
parent
4d45cd38d9
commit
1e0d38dc55
|
@ -51,7 +51,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<slot :width="bodyWidth" :height="bodyHeight"></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</FocusTrap>
|
</FocusTrap>
|
||||||
|
@ -59,7 +59,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { onMounted, onUnmounted } from "vue";
|
|
||||||
import { FocusTrap } from "focus-trap-vue";
|
import { FocusTrap } from "focus-trap-vue";
|
||||||
import MkModal from "./MkModal.vue";
|
import MkModal from "./MkModal.vue";
|
||||||
|
|
||||||
|
@ -90,8 +89,6 @@ const emit = defineEmits<{
|
||||||
let modal = $shallowRef<InstanceType<typeof MkModal>>();
|
let modal = $shallowRef<InstanceType<typeof MkModal>>();
|
||||||
let rootEl = $shallowRef<HTMLElement>();
|
let rootEl = $shallowRef<HTMLElement>();
|
||||||
let headerEl = $shallowRef<HTMLElement>();
|
let headerEl = $shallowRef<HTMLElement>();
|
||||||
let bodyWidth = $ref(0);
|
|
||||||
let bodyHeight = $ref(0);
|
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
modal.close();
|
modal.close();
|
||||||
|
@ -101,30 +98,6 @@ const onBgClick = () => {
|
||||||
emit("click");
|
emit("click");
|
||||||
};
|
};
|
||||||
|
|
||||||
const onKeydown = (evt) => {
|
|
||||||
if (evt.which === 27) {
|
|
||||||
// Esc
|
|
||||||
evt.preventDefault();
|
|
||||||
evt.stopPropagation();
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const ro = new ResizeObserver((entries, observer) => {
|
|
||||||
bodyWidth = rootEl.offsetWidth;
|
|
||||||
bodyHeight = rootEl.offsetHeight - headerEl.offsetHeight;
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
bodyWidth = rootEl.offsetWidth;
|
|
||||||
bodyHeight = rootEl.offsetHeight - headerEl.offsetHeight;
|
|
||||||
ro.observe(rootEl);
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
ro.disconnect();
|
|
||||||
});
|
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
close,
|
close,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue