mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 05:38:37 +08:00
update
This commit is contained in:
parent
eb1744d5f8
commit
5917d23286
@ -7,6 +7,8 @@ TextField{
|
||||
property var values:[]
|
||||
property int fontStyle: FluText.Body
|
||||
property int pixelSize : FluTheme.textSize
|
||||
property int icon: -1
|
||||
signal itemClicked(string data)
|
||||
|
||||
id:input
|
||||
width: 300
|
||||
@ -24,7 +26,7 @@ TextField{
|
||||
}
|
||||
return FluTheme.isDark ? Qt.rgba(210/255,210/255,210/255,1) : Qt.rgba(96/255,96/255,96/255,1)
|
||||
}
|
||||
rightPadding: 30
|
||||
rightPadding: icon_right.visible ? 50 : 30
|
||||
selectByMouse: true
|
||||
font.bold: {
|
||||
switch (fontStyle) {
|
||||
@ -83,12 +85,25 @@ TextField{
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
rightMargin: icon_right.visible ? 25 : 5
|
||||
}
|
||||
onClicked:{
|
||||
input.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
FluIcon{
|
||||
id:icon_right
|
||||
icon: input.icon
|
||||
iconSize: 15
|
||||
opacity: 0.5
|
||||
visible: input.icon != -1
|
||||
anchors{
|
||||
verticalCenter: parent.verticalCenter
|
||||
right: parent.right
|
||||
rightMargin: 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
@ -152,6 +167,7 @@ TextField{
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
input_popup.close()
|
||||
input.itemClicked(modelData)
|
||||
input.text = modelData
|
||||
}
|
||||
}
|
||||
@ -175,6 +191,10 @@ TextField{
|
||||
|
||||
function searchData(){
|
||||
var result = []
|
||||
if(values==null){
|
||||
list_view.model = result
|
||||
return
|
||||
}
|
||||
values.map(function(item){
|
||||
if(item.indexOf(input.text)!==-1){
|
||||
result.push(item)
|
||||
|
@ -3,6 +3,6 @@ import FluentUI 1.0
|
||||
|
||||
Rectangle {
|
||||
|
||||
color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(238/255,238/255,238/255,1)
|
||||
color: FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
||||
|
||||
}
|
||||
|
@ -209,8 +209,12 @@ Item {
|
||||
clip: true
|
||||
anchors.margins: 10
|
||||
popEnter : Transition{}
|
||||
popExit : Transition{}
|
||||
pushEnter : Transition{}
|
||||
popExit : Transition {
|
||||
NumberAnimation { properties: "y"; from: 0; to: nav_swipe.height; duration: 200 }
|
||||
}
|
||||
pushEnter: Transition {
|
||||
NumberAnimation { properties: "y"; from: nav_swipe.height; to: 0; duration: 200 }
|
||||
}
|
||||
pushExit : Transition{}
|
||||
replaceEnter : Transition{}
|
||||
replaceExit : Transition{}
|
||||
@ -257,13 +261,58 @@ Item {
|
||||
duration: 300
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
id:layout_header
|
||||
width: layout_list.width
|
||||
height: 50
|
||||
|
||||
FluAutoSuggestBox{
|
||||
width: 280
|
||||
anchors.centerIn: parent
|
||||
icon: FluentIcons.Zoom
|
||||
values: {
|
||||
var arr = []
|
||||
if(items==null)
|
||||
return arr
|
||||
if(items.children==null)
|
||||
return arr
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
var item = items.children[i]
|
||||
if(item instanceof FluPaneItem){
|
||||
arr.push(item.title)
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
placeholderText: "查找"
|
||||
onItemClicked:
|
||||
(data)=>{
|
||||
var arr = []
|
||||
if(items==null)
|
||||
return arr
|
||||
if(items.children==null)
|
||||
return arr
|
||||
for(var i=0;i<items.children.length;i++){
|
||||
if(items.children[i].title === data){
|
||||
if(nav_list.currentIndex === i){
|
||||
return
|
||||
}
|
||||
items.children[i].tap()
|
||||
nav_list.currentIndex = i
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ListView{
|
||||
id:nav_list
|
||||
property bool enableStack: true
|
||||
property var stackIndex: []
|
||||
clip: true
|
||||
anchors{
|
||||
top: parent.top
|
||||
top: layout_header.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: layout_footer.top
|
||||
|
Loading…
Reference in New Issue
Block a user