yangchenggong1_wd

fix:bug[17197] 搜索-取消清空搜索记录,不应弹出键盘

... ... @@ -110,6 +110,10 @@ export struct SearchComponent {
this.searchHistoryData = SearcherAboutDataModel.getSearchHistoryData()
}
stopInput(){
this.controller.stopEditing()
}
build() {
Column() {
this.searchInputComponent()
... ... @@ -117,7 +121,7 @@ export struct SearchComponent {
Scroll(this.scroller) {
Column() {
if(this.searchHistoryData!=null && this.searchHistoryData.length>0){
SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index) })
SearchHistoryComponent({ searchHistoryData: $searchHistoryData, onDelHistory: (): void => this.getSearchHistoryData(),onGetSearchRes: (item,index): void => this.getSearchHistoryResData(item,index),onCloseInput : (): void => this.stopInput() })
}
if(this.searchHistoryData.length>0){
... ... @@ -257,7 +261,6 @@ export struct SearchComponent {
.textFont({ size: "27lpx", weight: "400lpx" })
// .defaultFocus(true)
.id("searchId")
.focusable(true)
.searchIcon({
size:0
})
... ...
... ... @@ -8,11 +8,14 @@ import { MyCustomDialog } from '../reusable/MyCustomDialog'
@Component
export struct SearchHistoryComponent{
@Link searchHistoryData:SearchHistoryItem[]
onCloseInput?: () => void;
onDelHistory?: () => void;
onGetSearchRes?: (item:string,index:number) => void;
dialogController: CustomDialogController = new CustomDialogController({
builder: MyCustomDialog({
cancel: this.onCancel,
cancel: () => {
this.onCancel()
},
confirm: () => {
this.onAccept()
},
... ... @@ -33,6 +36,9 @@ export struct SearchHistoryComponent{
}
onCancel() {
if (this.onCloseInput !== undefined) {
this.onCloseInput()
}
console.info('Callback when the first button is clicked')
}
... ...