1.ligerUIä¸ligerDialogåligerWindowçåºå«
ligerUIä¸ligerDialogåligerWindowçåºå«
ä»APIæ¥ç,php discuz源码分析å®ä»¬ä¹é´è§ä¹æ²¡ææ ¹æ¬æ§çåºå«,ä¸é¢ç对æ¯å¾,
æè¿éåªååºäºAPIææ¡£ä¸åæ°ç对æ¯å¾,ä¸¤ä¸ªç±»å ¶ä»çAPIä¹ä¸å¾ä¸æ åµå·®ä¸å¤,DialogçAPIæ¯è¾å¤,ä½å ä¹é½æ¶µçäºWindowä¸çAPI
WindowçAPIéé¢æ¯Dialogå¤åºäºä¸æ ·ä¸è¥¿,é£å°±æ¯äºä»¶åè°å½æ°.
å¨ ligerWindow.js ä¸,æåç°ç¬¬è¡,å¦ä¸
l.controls.Window.ligerExtend(l.core.Win, {
åæ ·æå¨ ligerDialog.js ä¸,è¡,æåæ ·çä¸å¥è¯,å¦ä¸
l.controls.Dialog.ligerExtend(l.core.Win, {
è¿è¡¨ç¤ºDialogä¸Windowæ¯ç»§æ¿èªåä¸ä¸ªç¶ç±» l.core.Win,éåææ¥çäº js/core/base.js,å¨è¿ä¸ªæ件çè¡æçå°äº liger.core.Win ççå®é¢ç®.liger.core.Win 并没æåå¾å¤çäºæ ,åªå®ç°é®ç½©åè½åå®ä¹ä¸äºæ½è±¡æ¥å£.
æåæåéæ°åå»é è¯»äº ligerDialog.js ç代ç ,ä»ç¬¬ è¡å¼å§ä¸ç´å°ç»æ,è¿ææ¯ Dialog ä¸ Window æ大çåºå«æå¨,Dialog æ¯åä¾å¯¹è±¡,ä¸å»ºè®®å¨ä½¿ç¨çæ¶å继æ¿ä¸æ©å±,è Window æ¯ä¸ä¸ªå¤ä¾ç±»,å 许ç´æ¥ç»§æ¿å¹¶æ©å±.
ææ¿åºæºç éé¢ 5个 æåºæ¬çå½æ°,æ¥è¯´æ Dialog æ¯åä¾ç±»çäºå®ï¼
$.ligerDialog.open = function (p)
{
// å®ä¾åä¸ä¸ª l.controls.Dialog 对象
// å é¨å¯ä»¥è¿½è¿°å°ç¬¬è¡,ä½¿ç¨ liger.run() å½æ°æé Dialog å®ä¾
return $.ligerDialog(p);
};
$.ligerDialog.close = function ()
{
// æ ¹æ® Dialogç±»å æ¥å°å°ææç dialog å®ä¾å¯¹è±¡
var dialogs = l.find(l.controls.Dialog.prototype.__getType());
// 循ç¯æ¯ä¸ä¸ª dialogå®ä¾å¹¶éæ¯
for (var i in dialogs)
{
var d = dialogs[i];
d.destroy.ligerDefer(d, 5);
}
// éèé®ç½©å±
// å¨ligerUIä¸,ææççªå£ä½¿ç¨çæ¯ä¸ä¸ªå ¨å±çmask
// ç¸å ³ä»£ç å¯ä»¥ç js/core/base.js è¡
l.win.unmask();
};
$.ligerDialog.show = function (p)
{
var dialogs = l.find(l.controls.Dialog.prototype.__getType());
if (dialogs.length)
{
for (var i in dialogs)
{
// å¦æå·²ç»åå¨ dialogå®ä¾,é£ä¹å°±ç´æ¥ä½¿ç¨å®ä¾å¯¹è±¡
// æ¾ç¤ºå·²åå¨çdialog,并è¿å
dialogs[i].show();
return;
}
}
// å¦æä¸åå¨ dialogå®ä¾,ååå§åä¸ä¸ªå®ä¾å¹¶è¿å
return $.ligerDialog(p);
};
$.ligerDialog.hide = function ()
{
var dialogs = l.find(l.controls.Dialog.prototype.__getType());
// éèdialogå®ä¾ä¹æ¯ç¸åçæ¹å¼
for (var i in dialogs)
{
var d = dialogs[i];
d.hide();
}
};
$.ligerDialog.tip = function (options)
{
// åå§åé项åæ°
options = $.extend({
showType: 'slide',
width: ,
modal: false,
height:
}, options || { });
$.extend(options, {
fixedType: 'se',
type: 'none',
isDrag: false,
isResize: false,
showMax: false,
showToggle: false,
showMin: false
});
// æé ä¸ä¸ªDialogå®ä¾
return $.ligerDialog.open(options);
};
æ ¹æ®ä¸é¢ç代ç 解读,ç»è®ºå°±å¾æ¸ æ°äºï¼
Dialogæ¯ä¸ä¸ªåä¾å¯¹è±¡,ä¸å»ºè®®ç»§æ¿ä¸æ©å±
Windowæ¯å¤ä¾ç±»,å 许继æ¿å¹¶æ©å±
æè§å¾ligerUI对Windowç设计没æ Ext 设计å¾å¥½,Dialogåºä½ä¸ºWindowçä¸ä¸ªåä¾å¯¹è±¡æç¸å¯¹åç,Extå°±æ¯è¿ä¹åç.æå ´è¶£çè¯,å¯ä»¥äºè§£ä¸Ext,Extæ¯ç®åæ认为å端UIç»ä»¶å设计å¾æ好çä¸ä¸ªæ¡æ¶.