@allahjs/umi-plugin-layout-lite
v0.2.0
Published
A lightweight Umi layout plugin with ProLayout and rightContentRender compatibility.
Readme
@allahjs/umi-plugin-layout-lite
轻量版 Umi Layout 插件,替代官方 layout 插件并保留常用能力:
- 自动注入全局布局(基于
ProLayout) - 支持
export const layout = (...) => ({ ... })运行时配置 - 支持
rightRender/rightContentRender - 兼容
@ant-design/pro-components3.x:内部自动把rightContentRender适配为actionsRender - 支持路由
icon字符串自动映射
安装
npm i @allahjs/umi-plugin-layout-lite使用
在 config/config.ts 中:
import { defineConfig } from '@umijs/max'
export default defineConfig({
layout: false,
plugins: [require.resolve('@allahjs/umi-plugin-layout-lite')],
})在 src/app.tsx 中:
export const layout = ({ initialState }: any) => ({
title: '管理系统',
rightContentRender: (_layoutProps: any, _dom: any, _meta: any) => {
return <div>自定义右上角</div>
},
})发布
cd packages/umi-plugin-layout-lite
npm publish --access public建议先发布 0.1.1(修复 CJS 产物在部分 MFSU 场景下的运行时兼容问题)。
