You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB
JavaScript

3 years ago
LoginPromptDialog = function DemoOutlinedBookletDialog(config){
LoginPromptDialog.parent.call(this, config);
};
OO.inheritClass(LoginPromptDialog, OO.ui.ProcessDialog);
LoginPromptDialog.static.name = 'loginPrompt';
LoginPromptDialog.static.title = '提示';
LoginPromptDialog.static.actions = [
{action: 'cancel', label: '取消', flags: ['primary', 'close']},
{action: 'register', label: '注册', flags: ['primary']},
{action: 'login', label: '登录', flags: ['primary', 'progressive']},
];
LoginPromptDialog.prototype.getBodyHeight = function(){
return 250;
};
LoginPromptDialog.prototype.initialize = function(){
LoginPromptDialog.parent.prototype.initialize.apply(this, arguments);
this.content = new OO.ui.PanelLayout({padded: true, expanded: false});
this.content.$element.append('<p>测试内容</p>');
this.$body.append(this.content.$element);
};
LoginPromptDialog.prototype.getActionProcess = function(action){
if (action === 'toggle'){
console.log('clicked');
} else if (action){
return new OO.ui.Process(function(){
this.close({ action: action });
}, this);
}
return LoginPromptDialog.parent.prototype.getActionProcess.call(this, action);
};
var windowManager = new OO.ui.WindowManager();
var dialog = new LoginPromptDialog();
$('body').append(windowManager.$element);
windowManager.addWindows([dialog]);
windowManager.openWindow(dialog);