diff --git a/product/phone/src/main/ets/pages/index.ets b/product/phone/src/main/ets/pages/index.ets index 38b84382..5a5ea7b6 100644 --- a/product/phone/src/main/ets/pages/index.ets +++ b/product/phone/src/main/ets/pages/index.ets @@ -130,12 +130,13 @@ struct IndexPage { initPhotosStore() { this.photosPreferences = AppStorage.get(Constants.PHOTOS_STORE_KEY) as Preferences; if (this.photosPreferences) { - this.photosPreferences.get('lastPage', 0).then((data: data_preferences.ValueType) => { + try { + const data: data_preferences.ValueType = this.photosPreferences.getSync('lastPage', 0) this.preIndex = data as number; this.currentIndex = this.preIndex; - }).catch((err: Error) => { + } catch (err) { this.updatePhotosStore('lastPage', 0); - }); + } } else { Log.info(TAG, 'photosPreferences is undefined'); } @@ -291,7 +292,7 @@ struct IndexPage { } .width('100%') .height('100%') - .visibility(this.currentIndex === Constants.TIMELINE_PAGE_INDEX ? Visibility.Visible : Visibility.Hidden) + } TabContent() { @@ -302,7 +303,7 @@ struct IndexPage { isShowSelectPhotoBrowser: $isShowSelectPhotoBrowser, pageStatus: this.pageStatus }) - .visibility(this.currentIndex === Constants.ALBUM_PAGE_INDEX ? Visibility.Visible : Visibility.Hidden) + } } .animationDuration(Constants.NUMBER_0)