# @tobosoft/ant-design-vue-pro-layout

> ant-design-vue-pro layout, easy to use pro scaffolding.

Latest version **1.3.1** (published 2023-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tobosoft/ant-design-vue-pro-layout
pnpm add @tobosoft/ant-design-vue-pro-layout
yarn add @tobosoft/ant-design-vue-pro-layout
bun add @tobosoft/ant-design-vue-pro-layout
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2023-04-21 |
| First published | 2023-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 280.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 547 |
| Maintainers | hankchang, tobosoft-publisher |

## Links

- npm: https://www.npmjs.com/package/@tobosoft/ant-design-vue-pro-layout
- Repository: https://github.com/vueComponent/pro-layout
- Homepage: https://github.com/vueComponent/pro-layout#readme
- Issues: https://github.com/vueComponent/pro-layout/issues
- npm.io page: https://npm.io/package/@tobosoft/ant-design-vue-pro-layout

## Dependencies (8)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [omit.js](https://npm.io/package/omit.js.md) ^1.0.2
- [classnames](https://npm.io/package/classnames.md) ^2.3.1
- [insert-css](https://npm.io/package/insert-css.md) ^2.0.0
- [umi-request](https://npm.io/package/umi-request.md) ^1.4.0
- [ant-design-vue](https://npm.io/package/ant-design-vue.md) ^1.7.8
- [vue-container-query](https://npm.io/package/vue-container-query.md) ^0.1.0
- [vue-copy-to-clipboard](https://npm.io/package/vue-copy-to-clipboard.md) ^1.0.3

## Recent versions

- 1.3.1 (latest) — 2023-04-21
- 1.3.0 — 2023-04-21
- 1.2.0 — 2023-04-12
- 1.1.1 — 2023-04-12
- 1.1.0 — 2023-04-12
- 1.0.14 — 2023-04-12
- 1.0.13 — 2023-04-12
- 1.0.12 — 2023-04-12

## README

English | [简体中文](./README.zh-CN.md)

<h1 align="center">Ant Design Pro Layout</h1>

<div align="center">

[![NPM version](https://img.shields.io/npm/v/@ant-design-vue/pro-layout/latest?style=flat)](https://npmjs.org/package/@ant-design-vue/pro-layout) [![Vue Support](https://img.shields.io/badge/support-Vue2-green?style=flat)](./package.json) [![NPM downloads](http://img.shields.io/npm/dm/@ant-design-vue/pro-layout.svg?style=flat)](https://npmjs.org/package/@ant-design-vue/pro-layout) [![License](https://img.shields.io/github/license/vueComponent/pro-layout)](./LICENSE)

</div>

## Usage

```bash
npm i @ant-design-vue/pro-layout --save
// or
yarn add @ant-design-vue/pro-layout
```

```jsx
import ProLayout from '@ant-design-vue/pro-layout'

// by jsx
export default {
  name: 'BasicLayout',
  render () {
    return (
      <ProLayout>
        <router-view />
      </ProLayout>
    )
  }
}
```

```vue
<template>
  <pro-layout
    :menus="menus"
    :collapsed="collapsed"
    :theme="theme"
    :layout="layout"
    :contentWidth="contentWidth"
    :auto-hide-header="autoHideHeader"
    :mediaQuery="query"
    :isMobile="isMobile"
    :handleMediaQuery="handleMediaQuery"
    :handleCollapse="handleCollapse"
  >
    <template v-slot:menuHeaderRender>
      <div>
        <img src="../assets/logo.svg" />
        <h1>Pro Layout</h1>
      </div>
    </template>
    <template v-slot:rightContentRender>
      <div :class="['ant-pro-global-header-index-right', layout === 'topmenu' && `ant-pro-global-header-index-${theme}`]">
        rightContentRender
      </div>
    </template>
    <template v-slot:footerRender>
      <div>footerRender</div>
    </template>
    <setting-drawer navTheme="dark" />
    <router-view />
  </pro-layout>
</template>

<script>

// by template
import ProLayout, { SettingDrawer } from '@ant-design-vue/pro-layout'
import { asyncRouterMap } from '../config/router.config'

export default {
  name: 'BasicLayout',
  data () {
    return {
      menus: [],
      collapsed: false,
      autoHideHeader: false,
      query: {},
      layout: 'sidemenu',
      contentWidth: 'Fluid',
      theme: 'dark',
      isMobile: false
    }
  },
  created () {
    this.menus = asyncRouterMap.find(item => item.path === '/').children
  },
  methods: {
    handleMediaQuery (query) {
      this.query = query
      if (this.isMobile && !query['screen-xs']) {
        this.isMobile = false
        return
      }
      if (!this.isMobile && query['screen-xs']) {
        this.isMobile = true
        this.collapsed = false
      }
    },
    handleCollapse (collapsed) {
      this.collapsed = collapsed
    }
  },
  components: {
  	SettingDrawer
  }
}
</script>
```



## API



### ProLayout

| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| title | layout in the upper left corner title | VNode \| String | `'Ant Design Pro'` |
| logo | layout top left logo url | VNode \| render | - |
| loading`*` | layout loading status | boolean | - |
| layout | layout menu mode, sidemenu: right navigation, topmenu: top navigation | 'sidemenu' \| 'topmenu' | `'sidemenu'` |
| contentWidth | content mode of layout, Fluid: adaptive, Fixed:  fixed width 1200px | 'Fixed' \| 'Fluid' | `Fluid` |
| theme | Navigation menu theme | 'light' \| 'dark' | `'dark'` |
| menus | Vue-router `routes` prop | Object | `[{}]` |
| collapsed | control menu's collapse and expansion | boolean | true |
| isMobile | is mobile | boolean | false |
| handleCollapse | folding collapse event of menu | (collapsed: boolean) => void | - |
| menuHeaderRender | render logo and title | v-slot \| VNode \| (logo,title)=>VNode \| false | - |
| headerRender | custom header render method | (props: BasicLayoutProps) => VNode | - |
| rightContentRender | header right content render method | (props: HeaderViewProps) => VNode | - |
| collapsedButtonRender | custom collapsed button method | (collapsed: boolean) => VNode | - |
| footerRender | custom footer render method | (props: BasicLayoutProps) => VNode | `false` | - |
| breadcrumbRender | custom breadcrumb render method | ({ route, params, routes, paths, h }) => VNode[] | - |
| i18nRender | i18n | Function (key: string) => string \| `false` | `false` |
| handleMediaQuery | media matchs callback | (querys: []) => void | - |
| mediaQuery            | media matchs                                                 | Array                              | -                  |
| openOnceKey           | menu only open root key | `true`     | - |


### PageHeaderWrapper

| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| content | Content area | VNode \| v-slot | - |
| extra | Extra content area, on the right side of content | VNode \| v-slot | - |
| extraContent | Extra content area, on the right side of content | VNode \| v-slot | - |
| tabList | Tabs title list | `Array<{key: string, tab: sting}>` | - |
| tab-change | Switch panel callback | (key) => void | - |
| tab-active-key | The currently highlighted tab item | string | - |




### SettingDrawer

#### {settings}
| Property | Description | Type | Default Value |
| ---- | ---- | ---- | ---- |
| theme | Theme | `dark` `light` `realDark` | `light` |
| layout | Sider Layout | `sidemenu` `topmenu` | `sidemenu` |
| primaryColor | Primary color (*development only) | `#1890ff` |      |
| contentWidth | content mode of layout, Fluid: adaptive, Fixed:  fixed width 1200px | 'Fixed' \| 'Fluid' | `Fluid` |

---
_Source: https://npm.io/package/@tobosoft/ant-design-vue-pro-layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
