From 68925ae6baa5eeb2526c6cb384dc5f0497f25b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BF=97=E6=B8=AF?= Date: Mon, 10 Apr 2023 03:29:48 +0000 Subject: [PATCH] update feature/pagedesktop/src/main/ets/default/viewmodel/PageDesktopViewModel.ts. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王志港 --- .../ets/default/viewmodel/PageDesktopViewModel.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/feature/pagedesktop/src/main/ets/default/viewmodel/PageDesktopViewModel.ts b/feature/pagedesktop/src/main/ets/default/viewmodel/PageDesktopViewModel.ts index 80f495d7..b953a01b 100644 --- a/feature/pagedesktop/src/main/ets/default/viewmodel/PageDesktopViewModel.ts +++ b/feature/pagedesktop/src/main/ets/default/viewmodel/PageDesktopViewModel.ts @@ -779,7 +779,7 @@ export default class PageDesktopViewModel extends BaseViewModel { 'row': row, 'column': column }; - if (AppStorage.Get('isPortrait')) { + if (AppStorage.Has('isPortrait') && AppStorage.Get('isPortrait')) { let cardInfoHorizontal: any[] = []; for (let i = 0; i < info.layoutInfo.length; i++) { if (info.layoutInfo[i].typeId == CommonConstants.TYPE_FOLDER) { @@ -807,7 +807,7 @@ export default class PageDesktopViewModel extends BaseViewModel { AppStorage.SetOrCreate('isPortraitCard', cardInfoHorizontal); } - if (!AppStorage.Get('isPortrait')) { + if (AppStorage.Has('isPortrait') && !AppStorage.Get('isPortrait')) { for (let i = 0; i < info.layoutInfo.length; i++) { if (info.layoutInfo[i].typeId == CommonConstants.TYPE_FOLDER) { let tt = info.layoutInfo[i].column @@ -841,6 +841,15 @@ export default class PageDesktopViewModel extends BaseViewModel { } } + if (!AppStorage.Has('isPortrait')) { + newLayoutInfo.layoutDescription = { + 'pageCount': pageNum, + 'row': row, + 'column': column + }; + newLayoutInfo.layoutInfo = []; + } + return newLayoutInfo; } @@ -887,7 +896,7 @@ export default class PageDesktopViewModel extends BaseViewModel { isBlankPage(): boolean { const curPageIndex = this.mPageDesktopModel.getPageIndex(); // 当且仅当只有一个页面时,菜单项只允许添加 - if (curPageIndex === 0 || this.getGridPageCount() <= 1) { + if (this.getGridPageCount() <= 1) { return false; } if (CheckEmptyUtils.isEmpty(this.mGridAppsInfos) || CheckEmptyUtils.isEmpty(this.mGridAppsInfos[curPageIndex])