Skip to content

Commit 3632f65

Browse files
committed
set max tabs to 8
1 parent c4a9d37 commit 3632f65

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

entry/src/main/ets/pages/TabSheetComponent.ets

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { FULL_PERCENT, STYLE_CONFIGURATION } from '../model/TabStyle';
22
import { TermModel } from '../model/TermModel';
33

4+
const MAX_TABS = 8
5+
46
@Component
57
export struct TabSheets {
68
@Link tabArray: Array<TermModel>;
@@ -64,13 +66,13 @@ export struct TabSheets {
6466
}
6567
}, (item: TermModel) => 'tab-' + item.id.toString())
6668

67-
Image($r('app.media.ic_public_add_filled'))
68-
.width(STYLE_CONFIGURATION.ICON_SIZE)
69-
.aspectRatio(1)
70-
.padding(2)
71-
.borderRadius(4)
72-
.onClick(() => {
73-
if (this.tabArray.length < 6) {
69+
if (this.tabArray.length < MAX_TABS) {
70+
Image($r('app.media.ic_public_add_filled'))
71+
.width(STYLE_CONFIGURATION.ICON_SIZE)
72+
.aspectRatio(1)
73+
.padding(2)
74+
.borderRadius(4)
75+
.onClick(() => {
7476

7577
const newArray = Array.from(this.tabArray)
7678
newArray.push(new TermModel(this.closeTabAndTerm));
@@ -82,9 +84,9 @@ export struct TabSheets {
8284
this.getUIContext().animateTo({ duration: 200 }, () => {
8385
this.focusIndex = newTabIndex;
8486
})
85-
}
86-
})
87-
.hoverEffect(HoverEffect.Highlight)
87+
})
88+
.hoverEffect(HoverEffect.Highlight)
89+
}
8890
}
8991
.padding(STYLE_CONFIGURATION.TAB_SHEET_PADDING)
9092
.backgroundColor($r('sys.color.ohos_id_color_sub_background'))

0 commit comments

Comments
 (0)