Skip to content

Commit

Permalink
fix(tabs): [tabs] 修复3.18.0版本更多按钮issue单
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxi-20 committed Feb 7, 2025
1 parent 0077e61 commit 36d612e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
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)
}
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

0 comments on commit 36d612e

Please sign in to comment.