Compare commits

..

No commits in common. "3bd491ee5b85b6234eb2d2eed2d0aac1d8048648" and "bfb2adb7f960b88b3abc4849593862cc1467feec" have entirely different histories.

1 changed files with 14 additions and 35 deletions

View File

@ -4,8 +4,6 @@ import QtQuick.Window
import QtQuick.Controls
import QtQuick.Controls.Basic
import FluentUI
import QtQml
import "qrc:///AicsKnowledgeBase/qml/global"
Rectangle {
id: input
@ -15,32 +13,10 @@ Rectangle {
radius: 5
clip: true
border.color: textInput.activeFocus ? "#268CDC":"#979592" //gray100
ListModel { id: tagListModel }
property ListModel tagList: tagListModel
property var tagMap:[]
property var presetsTags:[]
property var presetsTagsItem:[]
Component.onCompleted: {
Request.get("tag?name",
function(result, data){
// console.log("success")
// console.log(result)
// console.log(data.length)
for(var i =0;i<data.length;i++){
tagMap.push([data[i].id,data[i].name])
presetsTags.push(data[i].name)
presetsTagsItem.push({title:data[i].name})
}
// console.log(tagMap)
// console.log(presetsTags)
},function (p1, p2) {
// console.log("failure")
// console.log(p1)
// console.log(p2)
})
}
Row {
x: 5
@ -72,23 +48,23 @@ Rectangle {
width: input.width - rowTag.width
height: parent.height
FluAutoSuggestBox{
TextField {
id:textInput
anchors.verticalCenter: parent.verticalCenter
width: parent.width
placeholderText: "按回车键Enter创建标签"
Layout.preferredWidth: 300
//items:[{title:""},{title:""},{title:""}]
items: presetsTagsItem
placeholderText: qsTr("按回车键Enter创建标签")
onFocusChanged: {
text =""
}
Keys.onReturnPressed: {
anchors.verticalCenter: parent.verticalCenter
width: parent.width - 15
clip: true
background: Rectangle {
}
Keys.onReturnPressed: {
var presetsTags = ["前端","后端","数据库"]
if (text.length === 0)
return
@ -96,10 +72,12 @@ Rectangle {
text = ""
return
}
tagListModel.append({"tag": text})
//console.log(tagListModel.get(0))
text = ""
}
Keys.onPressed: {
if (event.key === Qt.Key_Backspace) {
if (text.length === 0 && tagListModel.count) {
@ -108,6 +86,7 @@ Rectangle {
}
}
}
}
}