Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ant-design-vue/pro-layout

Package Overview
Dependencies
Maintainers
3
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ant-design-vue/pro-layout

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

  • 1.0.13
  • npm
  • Socket score

Version published
Weekly downloads
757
decreased by-40.49%
Maintainers
3
Weekly downloads
 
Created
Source

English | 简体中文

Ant Design Pro Layout

Usage

npm i @ant-design-vue/pro-layout --save
// or
yarn add @ant-design-vue/pro-layout
import ProLayout from '@ant-design-vue/pro-layout'

// by jsx
export default {
  name: 'BasicLayout',
  render () {
    return (
      <ProLayout>
        <router-view />
      </ProLayout>
    )
  }
}
<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

PropertyDescriptionTypeDefault Value
titlelayout in the upper left corner titleVNode | String'Ant Design Pro'
logolayout top left logo urlVNode | render-
loading*layout loading statusboolean-
layoutlayout menu mode, sidemenu: right navigation, topmenu: top navigation'sidemenu' | 'topmenu''sidemenu'
contentWidthcontent mode of layout, Fluid: adaptive, Fixed: fixed width 1200px'Fixed' | 'Fluid'Fluid
themeNavigation menu theme'light' | 'dark''dark'
menusVue-router routes propObject[{}]
collapsedcontrol menu's collapse and expansionbooleantrue
isMobileis mobilebooleanfalse
handleCollapsefolding collapse event of menu(collapsed: boolean) => void-
menuHeaderRenderrender logo and titlev-slot | VNode | (logo,title)=>VNode | false-
headerRendercustom header render method(props: BasicLayoutProps) => VNode-
rightContentRenderheader right content render method(props: HeaderViewProps) => VNode-
collapsedButtonRendercustom collapsed button method(collapsed: boolean) => VNode-
footerRendercustom footer render method(props: BasicLayoutProps) => VNodefalse
breadcrumbRendercustom breadcrumb render method({ route, params, routes, paths, h }) => VNode[]-
i18nRenderi18nFunction (key: string) => string | falsefalse
handleMediaQuerymedia matchs callback(querys: []) => void-
mediaQuerymedia matchsArray-
openOnceKeymenu only open root keytrue-

PageHeaderWrapper

PropertyDescriptionTypeDefault Value
contentContent areaVNode | v-slot-
extraExtra content area, on the right side of contentVNode | v-slot-
extraContentExtra content area, on the right side of contentVNode | v-slot-
tabListTabs title listArray<{key: string, tab: sting}>-
tab-changeSwitch panel callback(key) => void-
tab-active-keyThe currently highlighted tab itemstring-

SettingDrawer

{settings}
PropertyDescriptionTypeDefault Value
themeThemedark light realDarklight
layoutSider Layoutsidemenu topmenusidemenu
primaryColorPrimary color (*development only)#1890ff
contentWidthcontent mode of layout, Fluid: adaptive, Fixed: fixed width 1200px'Fixed' | 'Fluid'Fluid

FAQs

Package last updated on 30 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc