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

fix(tabs): [tabs] Fix more button failure issues in version 3.18.0 #2867

Open
wants to merge 1 commit into
base: release-3.18.0
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 packages/renderless/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opentiny/vue-renderless",
"version": "3.18.8",
"version": "3.18.9",
"private": true,
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
"author": "OpenTiny Team",
Expand Down
15 changes: 10 additions & 5 deletions packages/renderless/src/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,20 @@ export const calcMorePanes =

if (tabs && tabs.length) {
let tabsAllWidth = 0

if (state.currentIndex === -1) {
state.currentIndex = state.panes.findIndex((item) => item.state.paneName === state.currentName)
chenxi-20 marked this conversation as resolved.
Show resolved Hide resolved
}
const currentIndex = state.currentIndex < 0 ? 0 : state.currentIndex
const tabsHeaderWidth = tabNavRefs.navScroll.offsetWidth

for (let i = 0; i < tabs.length; i++) {
const tabItem = tabs[i] as HTMLElement
// 遮住元素一半则隐藏
tabsAllWidth = tabItem.offsetLeft + tabItem.offsetWidth / 2
const tabsHeaderWidth = tabNavRefs.navScroll.offsetWidth
const currentName = Number(state.currentName || 0)
if (tabsAllWidth > tabsHeaderWidth && currentName >= 0) {
if (currentName >= i + 1) {
state.showPanesCount = currentName - 0
if (tabsAllWidth > tabsHeaderWidth && currentIndex >= 0) {
if (currentIndex >= i + 1) {
state.showPanesCount = currentIndex
} else {
state.showPanesCount = i
}
Expand Down
Loading