1.0.5 • Published 1 year ago

@charrue/layout-next v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

npm.io

layout-next

npm.io npm.io

介绍

Charrue Layout 是基于Element Plus封装的组件,致力于解决中后台布局的问题,提供自动生成菜单与定制页面布局。

下载

npm install element-plus @charrue/layout-next

使用

  1. 全局注册
import ElementPlus from "element-plus";
import Layout from "@charrue/layout-next";
import "element-plus/dist/index.css";
import "@charrue/layout-next/dist/index.css"; // 引入样式

const app = createApp(App);
app.use(Layout);
  1. 局部注册
<script setup>
import { CharrueLayout } from "@charrue/layout-next";
</script>

<template>
  <CharrueLayout>
    <router-view></router-view>
  </CharrueLayout>
</template>

<style>
@import "@charrue/layout-next/dist/index.css";
</style>

Props

属性名类型默认值说明
dataLayoutMenuItem[][]控制侧边栏数据展示如果为空数组,则不展示侧栏
collapsebooleanfalse控制菜单的收起和展开
fixedHeaderbooleantrue是否固定 header 到顶部
showTriggerbooleantrue是否显示菜单折叠触发器
logostring''layout 的左上角 的 logo
titlestring''layout 的左上角 的 title
layoutside | mixsidelayout 的菜单模式,side:右侧导航,mix:混合模式
homeRoutestring | { name: string }/首页的路由
absolutebooleanfalse是否设置为position:absolute,默认设置为position: fixed
sidebarWidth[number, number][54, 200]侧边菜单收起和展开的宽度
activeMenuRulesActiveMenuRulesType{}自定义侧栏菜单高亮规则

插槽

插槽名说明
header-left顶栏左侧
header-right顶栏右侧
sidebar-top侧栏顶部
sidebar-bottom侧栏底部
content-header内容区顶部
default内容区主体
content-footer内容区底部

事件

事件说明
update:collapse侧栏折叠状态更新

辅助函数

  • defineLayoutConfig
declare const defineLayoutConfig: (config: LayoutMenuItem[]) => LayoutMenuItem[];

在定义dataprop时提供类型提示

类型

interface LayoutMenuItem {
    title: string;
    path?: string;
    name?: string;
    icon?: string;
    children?: LayoutMenuItem[];
}

declare type ActiveMenuRulesType = Record<string, string | {
    name: string;
}>;
1.0.2

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.0-alpha.4

1 year ago

1.0.0-alpha.3

1 year ago

1.0.0-alpha.2

1 year ago

1.0.0-alpha.1

1 year ago

1.0.0-alpha.0

1 year ago

0.5.0

2 years ago

0.6.0

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.1.4

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago