Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug when resizing the browser window. #166

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/table/src/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
40 changes: 22 additions & 18 deletions src/components/tabs/src/tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down