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

[Bug Report] tab可滚动造成文字跟横杠错位 #2850 #2854

Merged
merged 2 commits into from Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/components/tab/metas.yml
Expand Up @@ -112,6 +112,11 @@ tab-item:
en: emits when current tabItem is clicked
zh-CN: 当前 tabItem 被点击时触发
changes:
next:
en:
- '[fix] tab #2850'
zh-CN:
- '[change] 修复 tab的父级width没有100%或者有padding 滚动造成文字跟横杠错位问题 #2850'
v2.9.1:
en:
- '[fix] fix box-sizing issue #2621. thanks to @suncodeer'
Expand Down
6 changes: 4 additions & 2 deletions src/components/tab/tab.vue
Expand Up @@ -67,13 +67,15 @@ export default {
computed: {
barLeft () {
if (this.hasReady) {
const count = this.scrollable ? (window.innerWidth / this.$children[this.currentIndex || 0].$el.getBoundingClientRect().width) : this.number
const nav = this.$refs.nav
const count = this.scrollable ? (nav.offsetWidth / this.$children[this.currentIndex || 0].$el.getBoundingClientRect().width) : this.number
return `${this.currentIndex * (100 / count)}%`
}
},
barRight () {
if (this.hasReady) {
const count = this.scrollable ? (window.innerWidth / this.$children[this.currentIndex || 0].$el.getBoundingClientRect().width) : this.number
const nav = this.$refs.nav
const count = this.scrollable ? (nav.offsetWidth / this.$children[this.currentIndex || 0].$el.getBoundingClientRect().width) : this.number
return `${(count - this.currentIndex - 1) * (100 / count)}%`
}
},
Expand Down