Skip to content

Commit

Permalink
Add modal event click overlay(devjin0617#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkdgusrnrlrl committed Aug 28, 2018
1 parent 6e985f8 commit 75fab67
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/components/Modal.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template lang="html">
<!-- Modal -->
<div class="modal fade" id="bsModal" tabindex="-1" role="dialog" aria-labelledby="bsModalLabel" data-toggle="modal" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" role="document">
<div class="modal fade" id="bsModal" tabindex="-1" role="dialog" aria-labelledby="bsModalLabel" data-toggle="modal" data-backdrop="static" data-keyboard="false" @click="clickOverlay">
<div class="modal-dialog" role="document" @click.stop>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
Expand Down Expand Up @@ -34,6 +34,7 @@ export default {
this.confirmAfterHook = args.confirmAfter
this.cancelBeforeHook = args.cancelBefore
this.cancelAfterHook = args.cancelAfter
this.clickOverlayHook = args.clickOverlay
$('#bsModal').modal('show')
})
Expand All @@ -45,6 +46,10 @@ export default {
this.cancelAfterHook()
this.resetProperties()
})
$('#bsModal').on('overlay.bs.modal', (e) => {
this.clickOverlayHook()
})
},
data () {
return {
Expand All @@ -56,7 +61,8 @@ export default {
confirmBeforeHook: () => {},
confirmAfterHook: () => {},
cancelBeforeHook: () => {},
cancelAfterHook: () => {}
cancelAfterHook: () => {},
clickOverlayHook: () => {}
}
},
methods: {
Expand All @@ -80,6 +86,9 @@ export default {
this.confirmAfterHook = () => {}
this.cancelBeforeHook = () => {}
this.cancelAfterHook = () => {}
},
clickOverlay: function () {
this.clickOverlayHook()
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/examples/ModalExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default {
},
cancelAfter: () => {
window.alert('닫기 이후 훅')
},
clickOverlay: () => {
window.alert('오버레이 클릭 훅')
}
})
}
Expand Down

0 comments on commit 75fab67

Please sign in to comment.