This commit is contained in:
zhuzichu 2023-07-13 10:20:45 +08:00
parent 0d87dadc61
commit 8595b2fdec
3 changed files with 72 additions and 4 deletions

View File

@ -12,7 +12,7 @@ FluScrollablePage{
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
height: 200 height: 240
paddings: 10 paddings: 10
ColumnLayout{ ColumnLayout{
spacing: 14 spacing: 14
@ -44,6 +44,12 @@ FluScrollablePage{
showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar") showSuccess("这是一个Success样式的InfoBar这是一个Success样式的InfoBar")
} }
} }
FluButton{
text:"Loading"
onClicked: {
showLoading()
}
}
} }
} }
CodeExpander{ CodeExpander{

View File

@ -105,7 +105,6 @@ Item {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
} }
MouseArea{ MouseArea{
id:item_layout_mouse id:item_layout_mouse
anchors.fill: parent anchors.fill: parent
@ -200,9 +199,7 @@ Item {
FluIconButton{ FluIconButton{
id:item_layout_expanded id:item_layout_expanded
color:"#00000000" color:"#00000000"
iconSource:item_layout.expanded?FluentIcons.ChevronDown:FluentIcons.ChevronRight
opacity: item_layout.hasChild opacity: item_layout.hasChild
iconSize: 15
onClicked: { onClicked: {
if(!item_layout.hasChild){ if(!item_layout.hasChild){
item_layout_rect.onClickItem() item_layout_rect.onClickItem()
@ -210,6 +207,18 @@ Item {
} }
model.expanded = !model.expanded model.expanded = !model.expanded
} }
contentItem: FluIcon{
rotation: item_layout.expanded?0:-90
iconSource:FluentIcons.ChevronDown
iconSize: 15
Behavior on rotation {
enabled: FluTheme.enableAnimation
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
}
}
} }
FluText { FluText {
text: item_layout.text text: item_layout.text

View File

@ -16,6 +16,7 @@ Window {
property string route property string route
property var argument:({}) property var argument:({})
property var pageRegister property var pageRegister
property Component loadingItem: com_loading
property var closeFunc: function(event){ property var closeFunc: function(event){
if(closeDestory){ if(closeDestory){
deleteWindow() deleteWindow()
@ -50,13 +51,65 @@ Window {
anchors.fill: parent anchors.fill: parent
clip: true clip: true
} }
Loader{
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: container
}
FluInfoBar{ FluInfoBar{
id:infoBar id:infoBar
root: window root: window
} }
Component{
id:com_loading
Popup{
id:popup_loading
modal:true
focus: true
anchors.centerIn: Overlay.overlay
closePolicy: {
if(cancel){
return Popup.CloseOnEscape | Popup.CloseOnPressOutside
}
return Popup.NoAutoClose
}
Overlay.modal: Rectangle {
color: "#44000000"
}
onVisibleChanged: {
if(!visible){
loader_loading.sourceComponent = undefined
}
}
visible: true
background: Item{}
contentItem: Item{
ColumnLayout{
spacing: 8
anchors.centerIn: parent
FluProgressRing{
Layout.alignment: Qt.AlignHCenter
}
FluText{
text:loadingText
Layout.alignment: Qt.AlignHCenter
}
}
}
}
}
WindowHelper{ WindowHelper{
id:helper id:helper
} }
function showLoading(text = "加载中...",cancel = true){
loader_loading.loadingText = text
loader_loading.cancel = cancel
loader_loading.sourceComponent = com_loading
}
function hideLoading(){
loader_loading.sourceComponent = undefined
}
function showSuccess(text,duration,moremsg){ function showSuccess(text,duration,moremsg){
infoBar.showSuccess(text,duration,moremsg) infoBar.showSuccess(text,duration,moremsg)
} }