!136 初始化字母索引不展示字幕

Merge pull request !136 from fanchenxuan/master_
This commit is contained in:
openharmony_ci 2023-06-25 10:10:44 +00:00 committed by Gitee
commit 09dc5640f7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 19 additions and 7 deletions

View File

@ -20,6 +20,14 @@ import { indexValue, appSort } from '../utils/utils';
export struct alphabetIndexerComponent {
@Link applicationItem: Array<any>; // application info array
@Link index: number; // alphabetical index
@State usingPopup: boolean = false;
aboutToAppear() {
const this_ = this;
setTimeout(function (){
this_.usingPopup = true;
}, 500)
}
build() {
AlphabetIndexer({ arrayValue: indexValue, selected: this.index })
@ -27,7 +35,7 @@ export struct alphabetIndexerComponent {
.selectedColor($r('sys.color.ohos_id_color_text_primary_activated')) // selected color
.popupColor($r('sys.color.ohos_id_color_text_primary_activated')) // popover color
.popupBackground($r('sys.color.ohos_id_color_card_bg')) // popover background color
.usingPopup(true) // whether to show a popup
.usingPopup(this.usingPopup) // whether to show a popup
.font({ size: $r('sys.float.ohos_id_text_size_body3') })
.popupFont({ size: $r('sys.float.ohos_id_text_size_headline7') }) // Demo of the popup
.onSelect((index: number) => {

View File

@ -506,9 +506,11 @@ struct applicationItem {
.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
.onScrollIndex((start, end) => {
globalThis.scroller = this.scroller;
let alphabeticalIndex = appSort(this.applicationList)[start].alphabeticalIndex;
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
this.selectedIndex = index >= 0 ? index : 0;
if (this.applicationList.length > 0) {
let alphabeticalIndex = appSort(this.applicationList)[start].alphabeticalIndex;
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
this.selectedIndex = index >= 0 ? index : 0;
}
})
}
}

View File

@ -318,9 +318,11 @@ struct applicationItem {
.padding({ top: Constants.LIST_PADDING_TOP, bottom: Constants.LIST_PADDING_BOTTOM })
.onScrollIndex((start, end) => {
globalThis.scroller = this.scroller;
let alphabeticalIndex = appSort(this.applicationList)[start].alphabeticalIndex;
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
this.selectedIndex = index >= 0 ? index : 0;
if (this.applicationList.length > 0) {
let alphabeticalIndex = appSort(this.applicationList)[start].alphabeticalIndex;
let index = indexValue.indexOf(alphabeticalIndex.toUpperCase());
this.selectedIndex = index >= 0 ? index : 0;
}
})
}
}