avoid empty search-results

show # results also uf term is entered by user without #
This commit is contained in:
molan-git 2020-06-09 12:05:25 +02:00
parent 092c7d880f
commit c22254364e

View file

@ -84,7 +84,11 @@ Page {
onSearchChanged: { onSearchChanged: {
console.log(search) console.log(search)
loader.sourceComponent = loading loader.sourceComponent = loading
loader.sourceComponent = search.charAt(0) === "@" ? userListComponent : tagListComponent if (search.charAt(0) === "@") {
loader.sourceComponent = userListComponent
} else if (search.charAt(0) === "#") {
loader.sourceComponen = tagListComponent
} else { loader.sourceComponent = worldListComponent}
} }
Loader { Loader {
@ -183,6 +187,31 @@ Page {
} }
} }
} }
Component {
id: wordListComponent
MyList {
id: view3
mdl: ListModel {}
width: parent.width
height: parent.height
onOpenDrawer: infoPanel.open = setDrawer
anchors.fill: parent
currentIndex: -1 // otherwise currentItem will steal focus
header: Item {
id: header
width: headerContainer.width
height: headerContainer.height
Component.onCompleted: headerContainer.parent = header
}
delegate: VisualContainer
Component.onCompleted: {
view3.type = "timelines/tag/"+tlSearch.search
view3.loadData("append")
}
}
}
} }
} }