fix: overlay before destroy hook

This commit is contained in:
07akioni 2019-06-17 19:21:53 +08:00
parent 0a0f7db1be
commit 8f9ecc211f
2 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "naive-ui",
"version": "0.1.29",
"version": "0.1.30",
"description": "",
"main": "index.js",
"scripts": {

View File

@ -40,9 +40,7 @@ export default {
},
beforeDestroy () {
this.removeOverlay()
console.log('removeContent', this.content)
//
this.app.removeChild(this.content)
this.app.removeChild(this.$refs.content)
},
methods: {
addOverlayToApp () {
@ -50,13 +48,16 @@ export default {
if (!overlay) {
overlay = document.createElement('div')
overlay.classList.add('n-modal-overlay')
overlay.id = 'overlay'
this.app.insertBefore(overlay, this.app.firstElementChild)
}
this.overlay = overlay
}
},
removeOverlay () {
if (this.overlay) {
this.app.removeChild(this.overlay)
let overlay = document.querySelector('#overlay')
console.log(overlay)
if (overlay) {
this.app.removeChild(overlay)
}
},
detachContentToApp () {