Ext.ux.form.SearchField 添加placeholder屬性 2016年9月19日

效果如圖:
搜索框
思路:
設置兩個變量,存放input的Id和placeholder值,
根據id更新input的placeholder值。

inputId: '',
placeholder : '',

initComponent 函數最後添加

me.inputId = me.id+'-inputEl';

afterRender函數最後添加

if(this.placeholder){    document.getElementById(this.inputId).setAttribute('placeholder',this.placeholder);
}

使用方法

 xtype: 'searchfield',
 placeholder: '查找',
 store: Store
發佈了79 篇原創文章 · 獲贊 38 · 訪問量 31萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章