說明:該組件是實現窗體化開發的基礎。
構造參數:
--title:窗體名稱
--minimizable:是否顯示最小化按鈕
--maximizable:是否顯示最大化按鈕
方法:
--show:使得窗口顯現
--hide:使得窗口隱藏
事件:
--hide:當隱藏時觸發
--show:當顯現時觸發
Ext.onReady(function(){ var _window = new Ext.Window({ title:"用戶登陸", frame:true, width:250, height:130, plain:true, layout:"form", labelWidth:45, resizable:false, constrain:true, closeAction:"hide", defaults:{xtype:"textfield",width:160}, bodyStyle:"padding:5px;", listeners:{ "show":function(){ alert("窗口顯示"); }, "hide":function(){ alert("窗口隱藏"); } }, items:[ {fieldLabel:"賬號"}, {fieldLabel:"密碼"} ], buttons:[ {text:"確定"}, {text:"取消",handler:function(){ _window.hide(); } } ] }); _window.render(Ext.getBody()); _window.show(); });
其中plain屬性為true時,可以強制窗體顏色各背景色變的一樣。
效果圖: