Add exception prompt

This commit is contained in:
jiaming743 2020-08-25 18:23:14 +08:00
parent 1db9bd4b6b
commit c8fb3596ee
1 changed files with 10 additions and 2 deletions

View File

@ -32,8 +32,14 @@ export default {
$nextTick(e => {
const dom = this.dom = $refs[ref]
this.width = dom.clientWidth
this.height = dom.clientHeight
this.width = dom ? dom.clientWidth : 0
this.height = dom ? dom.clientHeight : 0
if (!dom) {
console.warn('DataV: Failed to get dom node, component rendering may be abnormal!')
} else if (!this.width || !this.height) {
console.warn('DataV: Component width or height is 0px, rendering abnormality may occur!')
}
if (typeof onResize === 'function' && resize) onResize()
@ -56,6 +62,8 @@ export default {
unbindDomResizeCallback () {
let { domObserver, debounceInitWHFun } = this
if (!domObserver) return
domObserver.disconnect()
domObserver.takeRecords()
domObserver = null