Merge pull request #99 from mentalfl0w/dev

Add PageMode for FluNavigationView.
main
zhuzichu 2023-05-14 19:26:03 +08:00 committed by GitHub
commit ea04380bd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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