npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

element-admin-layout

v0.0.19

Published

## 快速开始

Downloads

21

Readme

一个基于 element-plus + vue3 的后台管理 Layout 组件

快速开始

1.安装依赖

// 安装依赖
npm i vue vue-router@4 vue-i18n@9 element-plus element-admin-layout

2.修改main.ts

import { createApp } from 'vue'
import i18n from './i18n'
import router from './router'
import App from './App.vue'

import ElementAdminLayout, {
	LayoutSetting,
	SwitchDark,
	SwitchFullScreen,
	SwitchLanguage,
	SwitchSize,
	SwitchTheme
} from 'element-admin-layout'
import 'element-admin-layout/dist/style.css'

createApp(App)
	.use(i18n)
	.use(router)
	.use(ElementAdminLayout, {
		logo: 'vite.svg',
		navbarComponents: [SwitchFullScreen, SwitchDark, SwitchSize, SwitchLanguage, SwitchTheme, LayoutSetting]
	})
	.mount('#app')

3.修改App.vue

<script setup lang="ts">
import { LayoutProvide } from 'element-admin-layout'
</script>

<template>
	<layout-provide>
		<RouterView />
	</layout-provide>
</template>

<style></style>

4.src目录下新建router.ts

import { createRouter, createWebHashHistory } from 'vue-router'
import { createLayoutRouter } from 'element-admin-layout'

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    createLayoutRouter([
      {
        path: '',
        name: 'Home',
        meta: {
          title: '首页',
          icon: 'mdi:home'
        },
        component: () => import('./views/home.vue')
      }
    ])
  ]
})

export default router

5.src目录下新建i18n.ts

import { createI18n } from 'vue-i18n'

const i18n = createI18n({
	legacy: false,
	allowComposition: true,
	locale: 'zh-cn',
	fallbackLocale: 'zh-cn',
	messages: {}
})

export default i18n

6.新增views文件夹,并创建home.vue

<script setup lang="ts">
import { LayoutProvide } from 'element-admin-layout'
</script>

<template>
	<layout-provide>
		<RouterView />
	</layout-provide>
</template>

<style></style>

自定义配置

1.全局配置

createApp(App).use(router).use(AdminLayout, {
  title: '管理系统测试', // 自定义标题
  logo: '/image/logo.png', // 引用public目录下的图片
}).mount('#app')

2.声明路由meta类型

创建typings.d.ts

import 'vue-router'

import { LayoutRouteMeta } from 'element-admin-layout'

declare module 'vue-router' {
  // 继承LayoutRouteMeta
  interface RouteMeta extends LayoutRouteMeta {
    // 自定义类型
    auth: boolean
  }
}