将监听的event名称改为exampleResize

This commit is contained in:
simon3000 2019-07-13 01:16:57 +02:00
parent a69b6b6406
commit ffc3c9d8a0
No known key found for this signature in database
GPG Key ID: 9E04DC65786E7851
2 changed files with 3 additions and 3 deletions

View File

@ -71,12 +71,12 @@ export default {
},
created() {
if (this.demo) {
window.addEventListener('resize', this.scrollToBottom)
window.addEventListener('exampleResize', this.scrollToBottom)
}
},
beforeDestroy() {
if (this.demo) {
window.removeEventListener('resize', this.scrollToBottom)
window.removeEventListener('exampleResize', this.scrollToBottom)
}
document.head.removeChild(this.styleElement)
},

View File

@ -310,7 +310,7 @@ export default {
}
},
mounted() {
const observer = new MutationObserver(() => window.dispatchEvent(new Event('resize')))
const observer = new MutationObserver(() => window.dispatchEvent(new Event('exampleResize')))
const child = document.querySelector('#example-container')
observer.observe(child, { attributes: true })