<template>
<MkModal ref="modal" @click="$emit('click')" @closed="$emit('closed')">
<div class="ebkgoccj _popup _narrow_" @keydown="onKeydown" :style="{ width: `${width}px`, height: scroll ? (height ? `${height}px` : null) : (height ? `min(${height}px, 100%)` : '100%') }">
<div class="header">
<button class="_button" v-if="withOkButton" @click="$emit('close')"><i class="fas fa-times"></i></button>
<span class="title">
<slot name="header"></slot>
</span>
<button class="_button" v-if="!withOkButton" @click="$emit('close')"><i class="fas fa-times"></i></button>
<button class="_button" v-if="withOkButton" @click="$emit('ok')" :disabled="okButtonDisabled"><i class="fas fa-check"></i></button>
</div>
<div class="body" v-if="padding">
<div class="_section">
<slot></slot>
<div class="body" v-else>
</MkModal>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import MkModal from './modal.vue';
export default defineComponent({
components: {
MkModal
},
props: {
withOkButton: {
type: Boolean,
required: false,
default: false
okButtonDisabled: {
padding: {
width: {
type: Number,
default: 400
height: {
default: null
canClose: {
default: true,
scroll: {
emits: ['click', 'close', 'closed', 'ok'],
data() {
return {
};
methods: {
close() {
this.$refs.modal.close();
onKeydown(e) {
if (e.which === 27) { // Esc
e.preventDefault();
e.stopPropagation();
this.close();
}
});
</script>
<style lang="scss" scoped>
.ebkgoccj {
overflow: hidden;
display: flex;
flex-direction: column;
contain: content;
--root-margin: 24px;
@media (max-width: 500px) {
--root-margin: 16px;
> .header {
$height: 58px;
$height-narrow: 42px;
flex-shrink: 0;
box-shadow: 0px 1px var(--divider);
> button {
height: $height;
width: $height;
height: $height-narrow;
width: $height-narrow;
> .title {
flex: 1;
line-height: $height;
padding-left: 32px;
font-weight: bold;
white-space: nowrap;
text-overflow: ellipsis;
pointer-events: none;
line-height: $height-narrow;
padding-left: 16px;
> button + .title {
padding-left: 0;
> .body {
overflow: auto;
</style>