diff --git a/src/imports/FluentUI/Controls/FluContentPage.qml b/src/imports/FluentUI/Controls/FluContentPage.qml index 4f3ac993..15f4842e 100644 --- a/src/imports/FluentUI/Controls/FluContentPage.qml +++ b/src/imports/FluentUI/Controls/FluContentPage.qml @@ -12,6 +12,8 @@ Item { property int topPadding: 0 property int rightPadding: 0 property int bottomPadding: 0 + property int pageMode: FluNavigationView.SingleTask + property string url: '' id:control diff --git a/src/imports/FluentUI/Controls/FluNavigationView.qml b/src/imports/FluentUI/Controls/FluNavigationView.qml index 2f951438..855d5215 100644 --- a/src/imports/FluentUI/Controls/FluNavigationView.qml +++ b/src/imports/FluentUI/Controls/FluNavigationView.qml @@ -22,6 +22,12 @@ Item { property Component autoSuggestBox property Component actionItem + enum PageModeFlag{ + Standard = 0, + SingleTop = 1, + SingleTask = 2 + } + id:control QtObject{ @@ -900,7 +906,32 @@ Item { } function push(url){ - nav_swipe.push(url) + if (nav_swipe.depth>0) + { + let page = nav_swipe.find(function(item) { + return item.url === url; + }) + if (page) + { + switch(page.pageMode) + { + case FluNavigationView.SingleTask: + while(nav_swipe.currentItem !== page) + { + nav_swipe.pop() + d.stackItems.pop() + } + return + case FluNavigationView.SingleTop: + if (nav_swipe.currentItem.url === url) + return + break + case FluNavigationView.Standard: + default: + } + } + } + nav_swipe.push(url,{url:url}) } function getCurrentIndex(){ diff --git a/src/imports/FluentUI/Controls/FluScrollablePage.qml b/src/imports/FluentUI/Controls/FluScrollablePage.qml index f71b85c6..00a0c4ff 100644 --- a/src/imports/FluentUI/Controls/FluScrollablePage.qml +++ b/src/imports/FluentUI/Controls/FluScrollablePage.qml @@ -13,6 +13,8 @@ Item { property int topPadding: 0 property int rightPadding: 10 property int bottomPadding: 10 + property int pageMode: FluNavigationView.SingleTask + property string url: '' id:control