Skip to content

Commit

Permalink
Add exception prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
jiaming743 committed Aug 25, 2020
1 parent 1db9bd4 commit c8fb359
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/mixin/autoResize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -56,6 +62,8 @@ export default {
unbindDomResizeCallback () {
let { domObserver, debounceInitWHFun } = this

if (!domObserver) return

domObserver.disconnect()
domObserver.takeRecords()
domObserver = null
Expand Down

0 comments on commit c8fb359

Please sign in to comment.