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

vue-crumbs

v1.2.1

Published

a simple and useful breadcrumbs for vue2.js

Downloads

33

Readme

vue-crumbs

Version License Downloads

a simple and useful breadcrumbs for Vue2.js

Features

  • Supports the vue-router 2.x.x
  • Supports params routes
  • Supports latest Firefox, Chrome, Safari, Opera and IE9+
  • Compact size 2KB (1KB gzipped)

Installation

NPM

$ npm install vue-crumbs --save

Bower

$ bower install vue-crumbs

Crumbs Attributes(组件属性)

| 参数 | 说明 | 类型 | 默认值 | |------------|----------------|--------------------|--------------| | mode | 面包屑模式,可选值为name url mix;name按照router命名模式配置面包屑,支持params路由,url自定义路由配置面包屑(之前的实现方式),mix混合模式,但是(一条完整的路径必须完整按name 或者url模式中的一个来配置,不能交叉配置) | String | mix | | rightIcon | 间隔Icon | String | rightIcon |

Routes Meta BreadCrumb Attributes (breadcrumb面包屑配置属性)

| 参数 | 说明 | 类型 | 默认值 | |------------|----------------|--------------------|--------------| | icon | 面包屑名称图标 | String | 无 | | url | 自定义URL(适用于url,mix模式) | String | 无 | | name | 面包屑名称 | String | 无 | | hidden | 是否隐藏 | Boolean | false |

How To Use


Import:
import Vue from 'vue'
import VueCrumbs from 'vue-crumbs'
Vue.use(VueCrumbs)

Component Use:
<breadcrumb rightIcon="fa fa-xxx" mode="mix"></breadcrumb>

Routes Config:
just like the Example below

Example That Use In vue-cli

routes.js:

url mode config

const routes = {
  routes:[{
    path:'/',
    component:page,
    meta:{
    breadcrumb:[{
      hidden:true, //if hidden is true ,current page breadcrumbs will be hidden
      url:'/',
      icon: '',
      name: 'Home Page'
    }]
    },
    children:[{
      path:'admin',
      component:admin,
      meta:{
        parent:'/',
        breadcrumb:[{
          url: '/admin',
          icon: '',
          name: 'admin page'
        }]
      }
    }]
  },{
    path:'/foo',
    component:foo,
     // if it is a query or param route
    beforeEnter: (to, from, next) => {
      to && (to.meta.breadcrumb[0].url = to.fullPath);
      window.sessionStorage.setItem('foo',to.fullPath);
      next();
    },
    meta:{
      parent:'/',
      breadcrumb:[{
        url: window.sessionStorage.getItem('foo'),
        name: 'foo Page'
      }]
    }
  },{
    path:'/foo/detail',
    component: detail,
    meta:{
      parent:'/foo',
      breadcrumb:[{
        url: '/foo/detail',
        icon: '',
        name: 'detail Page'
      }]
    }
  },{
    path:'/bar',
    component:bar,
    meta:{
      parent: '/',
      breadcrumb:[{
        name: 'bar page' //if no url,it will get current page url as <router-link> path
      }]
    }
  }]
 };
export default routes;

name mode config(support params routes)

URL: /admin/:pid/:cid

const routes = {
  routes:[{
    path:'/',
    component:page,
    name: 'home'
    meta:{
	    breadcrumb:{
	    	icon: '',
	    	hidden: true,
	     	name: 'Home Page'
	    }
    },
    children:[{
      path:'admin/:pid',
      component:admin,
      name: 'admin',
      meta:{
        parent:'home',
        breadcrumb:{
        	icon: '',
         	name: 'admin page'
        }
      }
    },{
    	path: 'admin/:pid/:cid',
    	component: child,
    	name: 'child',
    	meta: {
    		parent: 'admin',
    		breadcrumb: {
    			icon: '',
    			name: 'child page'
    		}
    	}
    }]
  },
  ]}

mix mode config:

URL: 
-  /admin/:pid/:cid => name mode
-  /foo/detail => url mode
const routes = {
  routes:[{
    path:'/',
    component:page,
    name: 'home'
    meta:{
    breadcrumb:{
    	icon: '',
    	hidden: true,
     	name: 'Home Page'
    }
    },
    children:[{
      path:'admin/:pid',
      component:admin,
      name: 'admin',
      meta:{
        parent:'home',
        breadcrumb:{
        	icon: '',
         	name: 'admin page'
        }
      }
    },{
    	path: 'admin/:pid/:cid',
    	component: child,
    	name: 'child',
    	meta: {
    		parent: 'admin',
    		breadcrumb: {
    			icon: '',
    			name: 'child page'
    		}
    	}
    }]
  },{
    path:'/foo',
    component:foo,
	 meta:{
      parent:'/',
      breadcrumb:[{
        url: '/foo',
        name: 'foo Page'
      }]
    }
  },{
    path:'/foo/detail',
    component: detail,
    meta:{
      parent:'/foo',
      breadcrumb:[{
        url: '/foo/detail',
        icon: '',
        name: 'detail Page'
      }]
    }
  },
  ]}

main.js:

import Vue from 'vue'
import VueRouter from 'vue-router'
import VueCrumbs from 'vue-crumbs'
import routes from './routes'
import App from './App'

Vue.use(VueRouter)
Vue.use(VueCrumbs)
const router = new VueRouter(routes)

const vm = new Vue({
  router,
  template: '<App/>',
  components: {
    App
  }
})

App.vue:

<template>
  <div id="app">
    <breadcrumb></breadcrumb>
  </div>
</template>
<script>
  export default {
    name: 'app'
  }
</script>
<style>
</style>

Contribution

Welcome to report issue and fork it

License

MIT