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

enn-navigation-bar

v0.0.11

Published

公共基础组件 导航栏组件

Downloads

5

Readme

NavigationBar

公共基础组件 导航栏组件

npm 地址:https://www.npmjs.com/package/enn-navigation-bar

示例

navigation-bar 单独使用

<template>
  <Nav
    title="XXX 网络管理平台"
    :user="user"
    :isLogged="isLogged"
    @onLogin="onLogin"
    @onLogout="onLogout"
  />
</template>

<script>
import Nav from 'enn-navigation-bar';
export default {
  components: {
    Nav,
  },
  data() {
    return {
      user: {},
      isLogged: false,
    };
  },
  methods: {
    onLogin() {
      this.user = {
        username: 'username',
        nickname: 'nickname',
        email: '[email protected]',
        phone: '13512345678',
      };
      this.isLogged = true;
      console.log('onLogin');
    },
    onLogout() {
      this.user = {};
      this.isLogged = false;
      console.log('onLogout');
    },
  },
};
</script>

<style>
html,
body {
  margin: 0;
  padding: 0;
}
</style>

Tips

  • 如果外面包裹了 el-header 需要手动重置 el-header 的样式。
<el-header style="height: 52px; padding: 0">
  <Nav :user="user" :isLogged="isLogged" @onLogin="onLogin" @onLogout="onLogout" />
</el-header>

API

NavigationBar Attributes

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------- | ------- | ---- | ------ | ------------------------------ | | logo | string | | - | logo 图片链接 | | logoHref | string | | - | 点击 logo 跳转的链接 | | title | string | | - | 页面标题 | | user | Object | 是 | - | 用户信息 | | isLogged | Boolean | 是 | false | 是否已登录 | | options | Array | | - | hover 显示的用户信息及相关操作 |

NavigationBar Events

| 事件名称 | 说明 | 回调参数 | | -------- | ---------------- | -------- | | onLogin | 登录按钮触发事件 | - | | onLogout | 登出按钮触发事件 | - |

user Attributes

| 参数 | 类型 | 必填 | 默认值 | 说明 | | -------- | ------ | ---- | ------ | ---------------- | | avatar | string | | - | 用户头像图片链接 | | username | string | | - | 用户名 |

options Attributes

| 参数 | 类型 | 必填 | 默认值 | 说明 | | ------- | -------- | ---- | ------ | ------------------------------------------------------------------------------------------------------- | | label | string | | - | 显示的文案 | | name | string | | - | 使用 router 进行跳转的 name | | href | string | | - | 如果为 https:// 或 http:// 或 // 开头,使用 window.open 打开该链接。否则使用 history.pushState 进行跳转 | | query | Object | | - | 链接参数 | | handler | Function | | - | 手动处理点击事件的回调函数,参数为该项的值 |

插槽 Slots

| 插槽名称 | 绑定值 | 作用 | | ---------- | ------ | ------------------ | | centerSlot | | 中间空白部分的插槽 |

<Nav
  title="XXX 网络管理平台"
  @onLogin="onLogin"
  @onLogout="onLogout"
>
  <template #centerSlot>centerSlot</template>
</Nav>