import { Vue, Component } from 'vue-property-decorator'; import { on } from '../../../../utils'; import { VNode } from 'vue'; import './app-content.less'; /** * 应用头部 * * @export * @class AppContent * @extends {Vue} */ @Component({}) export class AppContent extends Vue { /** * Creates an instance of AppContent. * @memberof AppContent */ constructor() { super(); on(window, 'keydown', (e: KeyboardEvent) => { if (e.ctrlKey && e.keyCode === 192) { this.changeBottom(); } }); } /** * 组件创建完毕 * * @protected * @memberof AppContent */ protected created(): void { if (this.$slots.content_bottom) { this.$footerRenderService.registerRightItem(() => { return (
this.changeBottom()} >
); }, 0); } } /** * 内容区底部区域,显示变更 * * @protected * @param {boolean} [judge] * @memberof AppContent */ protected changeBottom(judge?: boolean): void { if (judge !== undefined) { this.$uiState.changeLayoutState({ contentBottomShow: judge, }); } else { this.$uiState.changeLayoutState({ contentBottomShow: !this.$uiState.layoutState.contentBottomShow, }); } } /** * 绘制内容 * * @protected * @param {boolean} isSlot * @returns {*} * @memberof AppContent */ protected renderContent(isSlot: boolean): any { return (
{this.$slots.default}
{this.$slots.content_bottom ? (
this.changeBottom(false)}>
{this.$slots.content_bottom}
) : null}
); } /** * 绘制内容 * * @returns {VNode} * @memberof AppContent */ render(): VNode { let content: any = null; if (this.$uiState.layoutState.styleMode === 'STYLE2') { content = [
{this.$slots.content_left}
, this.renderContent(false)]; } else { content = this.$slots.content_left ? (
{this.$slots.content_left}
{this.renderContent(true)}
) : ( this.renderContent(false) ); } return
{content}
; } }