Skip to content
On this page

主题相关配置

布局方式预览

为了满足业务和品牌上多样化的功能需求,目前支持四种页面布局方式。

布局一

布局二

布局三

布局四

主题配置

本框架支持一定程度的功能定制,主要包括以下五个部分:

  • 菜单配置: MenuOptions
  • 头部配置: HeadOptions
  • 路由配置: RouteReuseOptions
  • 底部配置: FooterOptions
  • 内容区域配置: ContentOptions

src/core/config/init.config.ts中的themeConf属性配置。

ts
{
    ...
    themeConf: {
        // 是否保存在缓存中, 默认为false
        cache?: boolean

        // 头部设置
        headOptions?: HeadOptions

        // 菜单设置
        menuOptions?: MenuOptions

        // 底部设置
        footerOptions?: FooterOptions

        // 路由复用
        routeReuse?: RouteReuseOptions

        // 内容区域
        content?: ContentOptions
    }
}

具名插槽 slots

在框架开发中考虑到部分内容用户需要自己定制,所以留了一些插槽。下图中标出了插槽的名称:

插槽名称

代码中具体的写法如下:

html
<template>
    <DtTheme>
        <!-- logo自定义 -->
        <teamplate #logo="data">
            我是菜单上面的logo
        </teamplate>

        <!-- 菜单底部的插槽 -->
        <teamplate #menuFooter="data">
            我是左侧菜单下面法律法规内容
        </teamplate>

        <!-- 通知公告消息数,右上角badge -->
        <teamplate #notifyBadge>
            12
        </teamplate>

        <!-- 通知公告弹框内容自定义 -->
        <teamplate #notify>
            <ATabs>
                <ATabPane tab="通知"></ATabPane>
                <ATabPane tab="代办"></ATabPane>
            </ATabs>
        </teamplate>

        <!-- 用户信息下拉数据自定义 -->
        <teamplate #userInfo>
            <div>修改密码</div>
            <div>用户信息</div>
        </teamplate>

        <!-- 头部前面插入内容 -->
        <template #headerBefore>
			<div>header前面插入内容</div>
		</template>

        <!-- 头部后面插入内容 -->
		<template #headerAfter>
			<div>header后面插入内容</div>
		</template>

        <!-- 设置头像 -->
        <teamplate #icon>
            <img src="xxxxx" /> 
        </teamplate>

        <!-- 设置footer -->
        <teamplate #footer>
            <div>我是footer内容</div>
        </teamplate>
    </DtTheme>
</template>

<script lang="ts" setup>

</script>

API

路由配置 MenuOptions

属性说明类型默认值版本
fixed菜单是否跟随页面滚动booleantrue
theme主题Theme.Light
Theme.Dark
Theme.Dark
collapsed是否收缩菜单booleanfalse
canDrag是否支持拖拽改变菜单宽度booleantrue
split分割菜单(紧混合模式支持)booleanfalse
menuWidth菜单默认宽度number240
trigger是否显示菜单收缩控制按钮booleantrue
type菜单类型'sidebar'
'top-menu'
'mix'
'mix-sidebar'
'sidebar'
mode菜单模式'inline'
'horizontal'
'vertical'
true
mixSideTriggertype'mix-sidebar'模式是否支持悬浮切换菜单'hover' | 'click''hover'

头部配置 HeadOptions

属性说明类型默认值版本
fixed头部是否固定booleantrue
theme主题Theme.Light | Theme.DarkTheme.Light
showLogo是否有logoboolentrue
showBackToTop内容区域出现滚动条时是否显示'回到顶部'按钮boolentrue
useLockPage是否开启锁屏booleantrue
size页面元素尺寸large | middle | small'small'
showBreadCrumb是否展示面包屑booleantrue
showFullScreen是否展示全屏按钮booleantrue
showSearch是否展示菜单快速检索booleantrue
showNotice通知消息booleantrue
showLocaleSwitch语言切换booleantrue
showLoginOut登出按钮booleantrue
logoutClick登出按钮点击事件function(() => {})
showSettingTheme主题设置booleantrue

路由复用 RouteReuseOptions

属性说明类型默认值版本
show是否显示路由复用booleantrue
position路由复用显示的位置'top' | 'normal''normal'
cache是否缓存booleanfalse
canDrag是否支持拖拽booleantrue
showQuick是否显示快捷操作booleantrue
showRedo是否显示刷新按钮booleantrue
showFold更多操作booleantrue

底部配置 FooterOptions

属性说明类型默认值版本
showfooter是否显示booleantrue
title标题string'xxx'
subTitle子标题string'xxx'

内容配置 ContentOptions

属性说明类型默认值版本
contentMode内容区域是否使用定宽(类似于淘宝)full
fixed
'full'