mirror of
https://github.com/frappe/books.git
synced 2024-12-26 12:28:12 +00:00
3a2ca34ac0
- pass arguments in an object - add primaryAction prop
60 lines
1.5 KiB
Vue
60 lines
1.5 KiB
Vue
<template>
|
|
<div :class="['modal fade show d-block']"
|
|
tabindex="-1" role="dialog" aria-labelledby="frappe-modal-label" aria-hidden="true">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content shadow">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">{{ title }}</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="closeModal">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body modal-height">
|
|
<component ref="modalComponent" :is="component" v-bind="props" v-on="events"/>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<!-- <f-button secondary @click="closeModal">{{ _('Close') }}</f-button> -->
|
|
<f-button primary v-if="primaryAction" @click="onPrimaryAction">{{ primaryAction.label }}</f-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: {
|
|
title: {
|
|
type: String,
|
|
default: "Modal Title"
|
|
},
|
|
primaryAction: {
|
|
type: Object,
|
|
default: null
|
|
},
|
|
component: {
|
|
type: Object
|
|
},
|
|
props: {
|
|
type: Object
|
|
},
|
|
events: {
|
|
type: Object
|
|
}
|
|
},
|
|
methods: {
|
|
closeModal() {
|
|
this.$emit('close-modal');
|
|
},
|
|
onPrimaryAction() {
|
|
this.primaryAction.handler(this.$refs.modalComponent);
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
.modal-height {
|
|
max-height: 80vh;
|
|
overflow: auto;
|
|
}
|
|
</style>
|