Add PageMode for FluNavigationView.

This commit is contained in:
Mentalflow 2023-05-14 18:31:17 +08:00
parent 87a1e4744c
commit 57fa166da3
No known key found for this signature in database
GPG Key ID: 5AE68D4401A2EE71
3 changed files with 36 additions and 1 deletions

View File

@ -12,6 +12,8 @@ Item {
property int topPadding: 0 property int topPadding: 0
property int rightPadding: 0 property int rightPadding: 0
property int bottomPadding: 0 property int bottomPadding: 0
property int pageMode: FluNavigationView.SingleTask
property string url: ''
id:control id:control

View File

@ -22,6 +22,12 @@ Item {
property Component autoSuggestBox property Component autoSuggestBox
property Component actionItem property Component actionItem
enum PageModeFlag{
Standard = 0,
SingleTop = 1,
SingleTask = 2
}
id:control id:control
QtObject{ QtObject{
@ -900,7 +906,32 @@ Item {
} }
function push(url){ 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(){ function getCurrentIndex(){

View File

@ -13,6 +13,8 @@ Item {
property int topPadding: 0 property int topPadding: 0
property int rightPadding: 10 property int rightPadding: 10
property int bottomPadding: 10 property int bottomPadding: 10
property int pageMode: FluNavigationView.SingleTask
property string url: ''
id:control id:control