41 lines
1.2 KiB
Vue
41 lines
1.2 KiB
Vue
<template>
|
|
<dialog ref="dialog" class="score-dialog form-dialog" aria-labelledby="form-dialog-title" @cancel.prevent="close">
|
|
<form @submit.prevent="$emit('save')">
|
|
<div class="dialog-header">
|
|
<h2 id="form-dialog-title">{{ title }}</h2>
|
|
<button class="icon-button" type="button" aria-label="Закрыть" :disabled="busy" @click="close">
|
|
<AppIcon name="close" />
|
|
</button>
|
|
</div>
|
|
<div class="dialog-body"><slot /></div>
|
|
<div class="dialog-footer dialog-footer-actions">
|
|
<button class="button" type="button" :disabled="busy" @click="close">Отмена</button
|
|
><button class="button button-primary" :class="{ 'button-danger': danger }" type="submit" :disabled="busy">
|
|
{{ busy ? 'Сохраняем…' : submitLabel }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</dialog>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: {
|
|
title: { type: String, required: true },
|
|
busy: Boolean,
|
|
danger: Boolean,
|
|
submitLabel: { type: String, default: 'Сохранить' },
|
|
},
|
|
mounted() {
|
|
this.$refs.dialog.showModal()
|
|
},
|
|
beforeDestroy() {
|
|
this.$refs.dialog.close()
|
|
},
|
|
methods: {
|
|
close() {
|
|
if (!this.busy) this.$emit('close')
|
|
},
|
|
},
|
|
}
|
|
</script>
|