ext總結

  1. 自定義MessageBox
Ext.MessageBox.show({
    title:'提示',
    msg:'自定義按鈕',
    modal:true,
    buttons:Ext.Msg.YESNO
});
  1. 獲取dom
Ext.get('foo'); //通過Id獲取元素
  1. 添加類
addClass('elCss') //添加類
  1. 改變樣式
setStyle({ 
  color: 'red', 
  background: 'yellow', 
  font-weight: 'bold' 
}) //設置樣式
  1. query 操作
Ext.query("span") //所有的span元素
Ext.query("span", "foo"); //父元素爲‘foo’的span
Ext.query("#foo"); 
Ext.query(".foo"); 
Ext.query("*"); 
Ext.query("div p");  查詢p:被包含在divExt.query("*[class]");
Ext.query("*[class=bar]");
Ext.query("*[class^=b]");
Ext.query("*[class$=r]"); 
  1. 事件監聽
e.on({
    'click' : {
        fn: this.onClick,
        scope: this,
        delay: 100
    },
    'mouseover' : {
        fn: this.onMouseOver,
        scope: this
    },
    'mouseout' : {
        fn: this.onMouseOut,
        scope: this
    }
});
或者下面的
el.on({
    'click' : this.onClick,
    'mouseover' : this.onMouseOver,
    'mouseout' : this.onMouseOut,
    scope: this
});
  1. 通過id獲取組件
getCmp(id)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章