fix search box

Signed-off-by: yanjuntao <yanjuntao@huawei.com>
This commit is contained in:
yanjuntao
2022-05-05 15:24:56 +08:00
parent b48886a7dd
commit af4deba1eb
2 changed files with 21 additions and 6 deletions
@@ -657,6 +657,7 @@ export struct AddNoteComp {
export struct SearchComp {
@Consume('Search') search: boolean
@Consume('InputKeyword') inputKeyword: string
@Consume('Longpress') longpress: boolean
build() {
Row() {
@@ -673,20 +674,30 @@ export struct SearchComp {
Flex({ justifyContent: FlexAlign.Start }) {
Image($r('app.media.search')).width(18).height(18)
TextInput({ placeholder: $r('app.string.searchNote') })
.backgroundColor($r("app.color.color_ffffff"))
.backgroundColor(this.longpress ? $r("app.color.search_longpress_bgcolor_f7f8f9") : $r("app.color.color_ffffff"))
.caretColor($r("app.color.search_note_caret_color"))
.onChange((value: string) => {
LogUtil.info(TAG, "Search value: " + value)
this.inputKeyword = value
})
.enabled(this.longpress ? false : true)
.onEditChange((isEditing: boolean) => {
this.search = isEditing
})
.onChange((value: string) => {
if (!this.longpress) {
LogUtil.info(TAG, "Search value: " + value)
this.inputKeyword = value
}
})
.onClick(() => {
if (this.longpress) {
this.search = false
} else {
this.search = true
}
})
}
.height(40)
.opacity(this.longpress ? 0.4 : 1)
.padding({ left: 6, right: 12, top: 9, bottom: 9 })
.borderRadius(20)
.backgroundColor($r("app.color.color_ffffff"))
.border({ width: 1.5, color: $r("app.color.divider_color_e4e4e4") })
.margin({ right: this.search ? 40 : 0 })
}
@@ -80,6 +80,10 @@
"name": "folderlist_bgcolor_f1f3f5",
"value": "#f1f3f5"
},
{
"name": "search_longpress_bgcolor_f7f8f9",
"value": "#f7f8f9"
},
{
"name": "notelist_bgcolor_f1f3f5",
"value": "#f1f3f5"