FluentUI
FluentUI copied to clipboard
FluComboBox在example中示例代码无法正常响应回车时间
FluComboBox {
editable: true
font:FluTextStyle.BodyStrong
model: ListModel {
id: model_2
ListElement { text: "Banana" }
ListElement { text: "Apple" }
ListElement { text: "Coconut" }
}
onAccepted: {
if (find(editText) === -1)
model_2.append({text: editText})
}
}
这里的onAccepted在Windows上测试是无法正常响应回车的. 查看代码发现内部已经监听了按键ENTER了
Keys.onEnterPressed: (event)=> handleCommit(event)
Keys.onReturnPressed:(event)=> handleCommit(event)
function handleCommit(event){
control.commit(control.editText)
}
更改为:
onCommit: {
print("acc")
print(find(editText))
if (find(editText) === -1)
model.append({text: editText})
}
就可以正常使用了