mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2026-02-10 19:39:31 +00:00
Minor code cleaning [2]
This commit is contained in:
@@ -439,6 +439,7 @@
|
|||||||
const stop = () => {
|
const stop = () => {
|
||||||
stopEventExecution = true
|
stopEventExecution = true
|
||||||
}
|
}
|
||||||
|
|
||||||
const beforeEvent = this.genEventObject({ stop, state, params })
|
const beforeEvent = this.genEventObject({ stop, state, params })
|
||||||
|
|
||||||
this.$emit(beforeEventName, beforeEvent)
|
this.$emit(beforeEventName, beforeEvent)
|
||||||
@@ -548,10 +549,11 @@
|
|||||||
*/
|
*/
|
||||||
callAfterEvent (state) {
|
callAfterEvent (state) {
|
||||||
if (state) {
|
if (state) {
|
||||||
this.observe()
|
this.connectObserver()
|
||||||
} else {
|
} else {
|
||||||
this.disconnectObserver()
|
this.disconnectObserver()
|
||||||
}
|
}
|
||||||
|
|
||||||
const afterEventName = state
|
const afterEventName = state
|
||||||
? 'opened'
|
? 'opened'
|
||||||
: 'closed'
|
: 'closed'
|
||||||
@@ -578,9 +580,9 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Start observing modal's DOM, if childList or subtree changes,
|
* Start observing modal's DOM, if childList or subtree changes,
|
||||||
* the callback (registered in created) will be called.
|
* the callback (registered in beforeMount) will be called.
|
||||||
*/
|
*/
|
||||||
observe () {
|
connectObserver () {
|
||||||
if (this.mutationObserver) {
|
if (this.mutationObserver) {
|
||||||
this.mutationObserver.observe(this.$refs.modal, {
|
this.mutationObserver.observe(this.$refs.modal, {
|
||||||
childList: true,
|
childList: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user