File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 11import { FULL_PERCENT, STYLE_CONFIGURATION } from '../model/TabStyle';
22import { TermModel } from '../model/TermModel';
33
4+ const MAX_TABS = 8
5+
46@Component
57export 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'))
You can’t perform that action at this time.
0 commit comments