Add a closable property to the modal animation
This commit is contained in:
parent
e5328dd1fb
commit
2eec1880c6
1 changed files with 15 additions and 2 deletions
|
|
@ -2,8 +2,9 @@
|
||||||
<transition name="fade" @after-enter="content = true">
|
<transition name="fade" @after-enter="content = true">
|
||||||
<div
|
<div
|
||||||
v-if="show"
|
v-if="show"
|
||||||
class="modal-container clickable"
|
class="modal-container"
|
||||||
@click.self.stop="content = false"
|
:class="closable ? 'clickable' : ''"
|
||||||
|
@click.self.stop="handleBackgroundClick"
|
||||||
>
|
>
|
||||||
<transition name="burst" @after-leave="$emit('closed')">
|
<transition name="burst" @after-leave="$emit('closed')">
|
||||||
<div v-if="content" class="modal unclickable">
|
<div v-if="content" class="modal unclickable">
|
||||||
|
|
@ -22,10 +23,22 @@ export default {
|
||||||
required: true,
|
required: true,
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
},
|
},
|
||||||
|
closable: {
|
||||||
|
required: false,
|
||||||
|
type: Boolean,
|
||||||
|
default: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {return {
|
data() {return {
|
||||||
content: false,
|
content: false,
|
||||||
}},
|
}},
|
||||||
|
methods: {
|
||||||
|
handleBackgroundClick() {
|
||||||
|
if (this.closable) {
|
||||||
|
this.content = false;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue