朱子楚\zhuzi 2023-06-03 08:27:56 +08:00
commit b2328ba82c
1 changed files with 11 additions and 7 deletions

View File

@ -6,6 +6,7 @@ FluTextBox{
property var items:[] property var items:[]
property string emptyText: "没有找到结果" property string emptyText: "没有找到结果"
property int autoSuggestBoxReplacement: FluentIcons.Search property int autoSuggestBoxReplacement: FluentIcons.Search
property var window : Window.window
signal itemClicked(var data) signal itemClicked(var data)
signal handleClicked signal handleClicked
id:control id:control
@ -22,17 +23,11 @@ FluTextBox{
y:control.height y:control.height
focus: false focus: false
enter: Transition { enter: Transition {
NumberAnimation {
property: "y"
from:0
to:control_popup.y
duration: 150
}
NumberAnimation { NumberAnimation {
property: "opacity" property: "opacity"
from:0 from:0
to:1 to:1
duration: 150 duration: 83
} }
} }
onVisibleChanged: { onVisibleChanged: {
@ -41,6 +36,7 @@ FluTextBox{
} }
} }
background: Rectangle{ background: Rectangle{
id:container
width: control.width width: control.width
radius: 4 radius: 4
FluShadow{ FluShadow{
@ -118,6 +114,14 @@ FluTextBox{
onTextChanged: { onTextChanged: {
loadData() loadData()
if(d.flagVisible){ if(d.flagVisible){
var pos = control.mapToItem(null, 0, 0)
if(window.height>pos.y+control.height+container.height){
control_popup.y = control.height
} else if(pos.y>container.height){
control_popup.y = -container.height
} else {
popup.y = window.height-(pos.y+container.height)
}
control_popup.visible = true control_popup.visible = true
} }
} }