mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
8dbfcfd994
commit
ac602c5afa
@ -6,7 +6,7 @@ import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
FluRemoteLoader{
|
||||
property int pageMode: FluNavigationView.Standard
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
||||
}
|
||||
|
@ -11,13 +11,13 @@ Item {
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
property int pageMode: FluNavigationView.Standard
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
id:control
|
||||
FluText{
|
||||
id:text_title
|
||||
visible: text !== ""
|
||||
height: visible ? implicitHeight : 0
|
||||
height: visible ? contentHeight : 0
|
||||
font: FluTextStyle.Title
|
||||
anchors{
|
||||
top: parent.top
|
||||
|
@ -14,7 +14,8 @@ Item {
|
||||
}
|
||||
enum PageModeFlag{
|
||||
Standard = 0,
|
||||
SingleTask = 1
|
||||
SingleTask = 1,
|
||||
SingleTop = 2
|
||||
}
|
||||
property url logo
|
||||
property string title: ""
|
||||
@ -893,9 +894,6 @@ Item {
|
||||
return nav_list.model
|
||||
}
|
||||
function push(url,argument={}){
|
||||
if(nav_swipe.currentItem && nav_swipe.currentItem.url === url && nav_swipe.currentItem.pageMode === FluNavigationView.SingleTask){
|
||||
return
|
||||
}
|
||||
let page = nav_swipe.find(function(item) {
|
||||
return item.url === url;
|
||||
})
|
||||
@ -909,6 +907,11 @@ Item {
|
||||
d.stackItems.pop()
|
||||
}
|
||||
return
|
||||
case FluNavigationView.SingleTop:
|
||||
if (nav_swipe.currentItem.url === url){
|
||||
return
|
||||
}
|
||||
break
|
||||
case FluNavigationView.Standard:
|
||||
default:
|
||||
}
|
||||
|
@ -2,25 +2,30 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
id:control
|
||||
FluStatusView {
|
||||
property url source: ""
|
||||
|
||||
color:"transparent"
|
||||
id:control
|
||||
onErrorClicked: {
|
||||
reload()
|
||||
}
|
||||
Loader{
|
||||
id:loader
|
||||
anchors.fill: parent
|
||||
source: control.source
|
||||
asynchronous: true
|
||||
onStatusChanged: {
|
||||
if(status === Loader.Error){
|
||||
control.statusMode = FluStatusView.Error
|
||||
}else if(status === Loader.Loading){
|
||||
control.statusMode = FluStatusView.Loading
|
||||
}else{
|
||||
control.statusMode = FluStatusView.Success
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluProgressRing{
|
||||
anchors.centerIn: parent
|
||||
visible: loader.status === Loader.Loading
|
||||
}
|
||||
|
||||
function reload(){
|
||||
var timestamp = Date.now();
|
||||
loader.source = control.source+"?"+timestamp
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,14 +12,14 @@ Item {
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
property int pageMode: FluNavigationView.Standard
|
||||
property int pageMode: FluNavigationView.SingleTop
|
||||
property string url: ''
|
||||
id:control
|
||||
FluText{
|
||||
id:text_title
|
||||
font: FluTextStyle.Title
|
||||
visible: text !== ""
|
||||
height: visible ? implicitHeight : 0
|
||||
height: visible ? contentHeight : 0
|
||||
padding: 0
|
||||
anchors{
|
||||
top: parent.top
|
||||
|
@ -13,6 +13,11 @@ Item{
|
||||
}
|
||||
default property alias content: container.data
|
||||
property int statusMode: FluStatusView.Loading
|
||||
property string loadingText:"正在加载..."
|
||||
property string emptyText: "空空如也"
|
||||
property string errorText: "页面出错了.."
|
||||
property string errorButtonText: "重新加载"
|
||||
property color color: FluTheme.dark ? Window.active ? Qt.rgba(38/255,44/255,54/255,1) : Qt.rgba(39/255,39/255,39/255,1) : Qt.rgba(251/255,251/255,253/255,1)
|
||||
signal errorClicked
|
||||
Item{
|
||||
id:container
|
||||
@ -28,6 +33,7 @@ Item{
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 83 }
|
||||
}
|
||||
color:control.color
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
visible: statusMode === FluStatusView.Loading
|
||||
@ -36,7 +42,7 @@ Item{
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
FluText{
|
||||
text:"正在加载..."
|
||||
text:control.loadingText
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
}
|
||||
@ -46,6 +52,7 @@ Item{
|
||||
border.width: 0
|
||||
anchors.fill: container
|
||||
visible: opacity
|
||||
color:control.color
|
||||
opacity: statusMode === FluStatusView.Empty
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 83 }
|
||||
@ -54,7 +61,7 @@ Item{
|
||||
anchors.centerIn: parent
|
||||
visible: statusMode === FluStatusView.Empty
|
||||
FluText{
|
||||
text:"空空如也"
|
||||
text:control.emptyText
|
||||
font: FluTextStyle.BodyStrong
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
@ -65,6 +72,7 @@ Item{
|
||||
border.width: 0
|
||||
anchors.fill: container
|
||||
visible: opacity
|
||||
color:control.color
|
||||
opacity: statusMode === FluStatusView.Error
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 83 }
|
||||
@ -72,14 +80,14 @@ Item{
|
||||
ColumnLayout{
|
||||
anchors.centerIn: parent
|
||||
FluText{
|
||||
text:"页面出错了..."
|
||||
text:control.errorText
|
||||
font: FluTextStyle.BodyStrong
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
FluFilledButton{
|
||||
id:btn_error
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text:"重新加载"
|
||||
text:control.errorButtonText
|
||||
onClicked:{
|
||||
control.errorClicked()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user