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"
|
import "qrc:///example/qml/component"
|
||||||
|
|
||||||
FluRemoteLoader{
|
FluRemoteLoader{
|
||||||
property int pageMode: FluNavigationView.Standard
|
property int pageMode: FluNavigationView.SingleTop
|
||||||
property string url: ''
|
property string url: ''
|
||||||
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
source: "https://zhu-zichu.gitee.io/T_RemoteLoader.qml"
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ 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.Standard
|
property int pageMode: FluNavigationView.SingleTop
|
||||||
property string url: ''
|
property string url: ''
|
||||||
id:control
|
id:control
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? contentHeight : 0
|
||||||
font: FluTextStyle.Title
|
font: FluTextStyle.Title
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
@ -14,7 +14,8 @@ Item {
|
|||||||
}
|
}
|
||||||
enum PageModeFlag{
|
enum PageModeFlag{
|
||||||
Standard = 0,
|
Standard = 0,
|
||||||
SingleTask = 1
|
SingleTask = 1,
|
||||||
|
SingleTop = 2
|
||||||
}
|
}
|
||||||
property url logo
|
property url logo
|
||||||
property string title: ""
|
property string title: ""
|
||||||
@ -893,9 +894,6 @@ Item {
|
|||||||
return nav_list.model
|
return nav_list.model
|
||||||
}
|
}
|
||||||
function push(url,argument={}){
|
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) {
|
let page = nav_swipe.find(function(item) {
|
||||||
return item.url === url;
|
return item.url === url;
|
||||||
})
|
})
|
||||||
@ -909,6 +907,11 @@ Item {
|
|||||||
d.stackItems.pop()
|
d.stackItems.pop()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
case FluNavigationView.SingleTop:
|
||||||
|
if (nav_swipe.currentItem.url === url){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
break
|
||||||
case FluNavigationView.Standard:
|
case FluNavigationView.Standard:
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
@ -2,25 +2,30 @@ import QtQuick
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
|
||||||
Item {
|
FluStatusView {
|
||||||
id:control
|
|
||||||
property url source: ""
|
property url source: ""
|
||||||
|
color:"transparent"
|
||||||
|
id:control
|
||||||
|
onErrorClicked: {
|
||||||
|
reload()
|
||||||
|
}
|
||||||
Loader{
|
Loader{
|
||||||
id:loader
|
id:loader
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: control.source
|
source: control.source
|
||||||
asynchronous: true
|
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(){
|
function reload(){
|
||||||
var timestamp = Date.now();
|
var timestamp = Date.now();
|
||||||
loader.source = control.source+"?"+timestamp
|
loader.source = control.source+"?"+timestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,14 @@ 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.Standard
|
property int pageMode: FluNavigationView.SingleTop
|
||||||
property string url: ''
|
property string url: ''
|
||||||
id:control
|
id:control
|
||||||
FluText{
|
FluText{
|
||||||
id:text_title
|
id:text_title
|
||||||
font: FluTextStyle.Title
|
font: FluTextStyle.Title
|
||||||
visible: text !== ""
|
visible: text !== ""
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? contentHeight : 0
|
||||||
padding: 0
|
padding: 0
|
||||||
anchors{
|
anchors{
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
@ -13,6 +13,11 @@ Item{
|
|||||||
}
|
}
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
property int statusMode: FluStatusView.Loading
|
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
|
signal errorClicked
|
||||||
Item{
|
Item{
|
||||||
id:container
|
id:container
|
||||||
@ -28,6 +33,7 @@ Item{
|
|||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: 83 }
|
NumberAnimation { duration: 83 }
|
||||||
}
|
}
|
||||||
|
color:control.color
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: statusMode === FluStatusView.Loading
|
visible: statusMode === FluStatusView.Loading
|
||||||
@ -36,7 +42,7 @@ Item{
|
|||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text:"正在加载..."
|
text:control.loadingText
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,6 +52,7 @@ Item{
|
|||||||
border.width: 0
|
border.width: 0
|
||||||
anchors.fill: container
|
anchors.fill: container
|
||||||
visible: opacity
|
visible: opacity
|
||||||
|
color:control.color
|
||||||
opacity: statusMode === FluStatusView.Empty
|
opacity: statusMode === FluStatusView.Empty
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: 83 }
|
NumberAnimation { duration: 83 }
|
||||||
@ -54,7 +61,7 @@ Item{
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
visible: statusMode === FluStatusView.Empty
|
visible: statusMode === FluStatusView.Empty
|
||||||
FluText{
|
FluText{
|
||||||
text:"空空如也"
|
text:control.emptyText
|
||||||
font: FluTextStyle.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
@ -65,6 +72,7 @@ Item{
|
|||||||
border.width: 0
|
border.width: 0
|
||||||
anchors.fill: container
|
anchors.fill: container
|
||||||
visible: opacity
|
visible: opacity
|
||||||
|
color:control.color
|
||||||
opacity: statusMode === FluStatusView.Error
|
opacity: statusMode === FluStatusView.Error
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: 83 }
|
NumberAnimation { duration: 83 }
|
||||||
@ -72,14 +80,14 @@ Item{
|
|||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
FluText{
|
FluText{
|
||||||
text:"页面出错了..."
|
text:control.errorText
|
||||||
font: FluTextStyle.BodyStrong
|
font: FluTextStyle.BodyStrong
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
}
|
}
|
||||||
FluFilledButton{
|
FluFilledButton{
|
||||||
id:btn_error
|
id:btn_error
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text:"重新加载"
|
text:control.errorButtonText
|
||||||
onClicked:{
|
onClicked:{
|
||||||
control.errorClicked()
|
control.errorClicked()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user