#178 Close dynamic modals programmatically

This commit is contained in:
Noel De Martin
2018-02-21 16:42:01 +01:00
parent 967745c3cd
commit 75ac5598fe
4 changed files with 38 additions and 10 deletions

View File

@@ -225,7 +225,7 @@ export default {
showDynamicRuntimeModal () {
this.$modal.show({
template: `
<div>
<div class="example-modal-content">
<h1>This is created inline</h1>
<p>{{ text }}</p>
</div>
@@ -243,9 +243,19 @@ export default {
},
showDynamicComponentModalWithModalParams () {
this.$modal.show(CustomComponentModal, {
text: 'This text is passed as a property'
}, {
this.$modal.show({
template: `
<div class="example-modal-content">
<button class="btn" @click="closeByName">Close this using name</button>
<button class="btn" @click="closeByEvent">Close this using events</button>
</div>
`,
methods: {
closeByName() { this.$modal.hide('dynamic-modal'); },
closeByEvent() { this.$emit('close'); },
}
}, null, {
name: 'dynamic-modal',
resizable: true,
adaptive: true,
draggable: true,

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div class="example-modal-content">
<h1>This is a custom component</h1>
<p>{{ text }}</p>
</div>