的問題用這個是小X不會被加入煎茶。這是html5「搜索」輸入的一個特性。要捕獲此事件,您需要查找搜索事件。我該如何解決,這是我編輯煎茶-touch.js
我修改 -
if (this.fieldEl) {
this.mon(this.fieldEl, {
focus: this.onFocus,
blur: this.onBlur,
keyup: this.onKeyUp,
paste: this.updateClearIconVisibility,
mousedown: this.onBeforeFocus,
scope: this
});
是 -
if (this.fieldEl) {
this.mon(this.fieldEl, {
focus: this.onFocus,
blur: this.onBlur,
keyup: this.onKeyUp,
paste: this.updateClearIconVisibility,
mousedown: this.onBeforeFocus,
search: this.onSearch,
scope: this
});
Ext.form.Text = Ext.extend內(分機。 form.Field,{...
現在在我的searchfield的實現中,我可以創建一個名爲onSearch的函數,它將在調用「search」事件時調用。請注意,「search」事件不僅被稱爲爲X但f或者像輸入鍵一樣的東西。底線是sencha touch 1.1根本不檢查這個事件,這是X發生事件的唯一時間,所以唯一的解決方法是修改sencha-touch.js。
我覆蓋了清除IconTap來清除事件。如果useClearIcon設置爲true,則onClearIconTap被擊中,然後我可以捕獲清除事件。沒有onClearIconTap,這將無法工作。我會很高興被證明是錯誤的...感謝您的答案! – Hoopes
這也是一個很好的解決方案。是的,只有在useClearIcon爲true的情況下才有可能。 :) – herkulano
我已將onClearIconTap覆蓋添加到代碼中。 – herkulano