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", "name": "naive-ui",
"version": "0.1.29", "version": "0.1.30",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

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