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

enn-navigation-bar

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enn-navigation-bar

公共基础组件 导航栏组件

  • 0.0.11
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

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@gmail.com',
        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

参数类型必填默认值说明
logostring-logo 图片链接
logoHrefstring-点击 logo 跳转的链接
titlestring-页面标题
userObject-用户信息
isLoggedBooleanfalse是否已登录
optionsArray-hover 显示的用户信息及相关操作

NavigationBar Events

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

user Attributes

参数类型必填默认值说明
avatarstring-用户头像图片链接
usernamestring-用户名

options Attributes

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

插槽 Slots

插槽名称绑定值作用
centerSlot中间空白部分的插槽
<Nav
  title="XXX 网络管理平台"
  @onLogin="onLogin"
  @onLogout="onLogout"
>
  <template #centerSlot>centerSlot</template>
</Nav>

Keywords

FAQs

Package last updated on 28 Feb 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