diff --git a/src/components/table/src/table.vue b/src/components/table/src/table.vue index 7ceaad7..0c728db 100644 --- a/src/components/table/src/table.vue +++ b/src/components/table/src/table.vue @@ -445,7 +445,7 @@ export default { this.$nextTick(() => { const columnsWidth = {} - if (this.data.length) { + if (this.data.length && this.$refs.body) { const $td = this.$refs.body.querySelectorAll('tr')[0].querySelectorAll('td') for (let i = 0; i < $td.length; i++) { diff --git a/src/components/tabs/src/tabs.vue b/src/components/tabs/src/tabs.vue index f0eba01..4806808 100644 --- a/src/components/tabs/src/tabs.vue +++ b/src/components/tabs/src/tabs.vue @@ -287,24 +287,28 @@ export default { }) }, updateHandle () { - const navWidth = this.$refs.nav.offsetWidth - const containerWidth = this.$refs.navScroll.offsetWidth - const currentOffset = this.getCurrentScrollOffset() - - if (containerWidth < navWidth) { - this.prevable = currentOffset !== 0 - this.nextable = currentOffset + containerWidth < navWidth - if (navWidth - currentOffset < containerWidth) { - this.setOffset(navWidth - containerWidth) - } - } else { - this.nextable = false - this.prevable = false - if (currentOffset > 0) { - this.setOffset(0) - } - } - } + if(this.$resf.nav && this.$refs.navScroll) { + const navWidth = this.$refs.nav.offsetWidth + const containerWidth = this.$refs.navScroll.offsetWidth + const currentOffset = this.getCurrentScrollOffset() + + if (containerWidth < navWidth) { + this.prevable = currentOffset !== 0 + this.nextable = currentOffset + containerWidth < navWidth + + if (navWidth - currentOffset < containerWidth) { + this.setOffset(navWidth - containerWidth) + } + } else { + this.nextable = false + this.prevable = false + + if (currentOffset > 0) { + this.setOffset(0) + } + } + } + } }, mounted () { window.addEventListener('resize', this.updateHandle, false)