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('

测试内容

'); 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);