All Projects → jypblue → vue-crumbs

jypblue / vue-crumbs

Licence: MIT license
a simple and useful breadcrumb for Vue2.js

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects

Projects that are alternatives of or similar to vue-crumbs

Magicmusic
🎵帅气的手机端音乐播放器(vue vue-router vuex flex ...)
Stars: ✭ 350 (+2087.5%)
Mutual labels:  vue2, vue-router2
Vue Cnode
基于vue2 + vue-router + vuet + ES6 + less + flex.css重写vue版cnode社区,使用webpack2打包
Stars: ✭ 1,134 (+6987.5%)
Mutual labels:  vue2, vue-router2
Easy Vue
Learn vueJS Easily 👻
Stars: ✭ 896 (+5500%)
Mutual labels:  vue2, vue-router2
Vue Fullstack
vue fullstack template
Stars: ✭ 297 (+1756.25%)
Mutual labels:  vue2, vue-router2
Login
Vue + Vue-router + Vuex 实现前端页面及逻辑,Express 实现注册登录登出的RestFul API 。
Stars: ✭ 246 (+1437.5%)
Mutual labels:  vue2, vue-router2
Vue Express Webpack Gulp
使用Vue,Express,Webpack,gulp搭建的自动化电影库项目
Stars: ✭ 42 (+162.5%)
Mutual labels:  vue2, vue-router2
Vue2 Web
酷我音乐—vue2、vue-router2、webpack2框架
Stars: ✭ 54 (+237.5%)
Mutual labels:  vue2, vue-router2
Vue Admin Element
(Vue2 演示项目)物业后台管理系统 - ElementUI ( 基本结构已完成, 剩下的就是具体业务开发; 如有疑问请留言 )
Stars: ✭ 73 (+356.25%)
Mutual labels:  vue2, vue-router2
M Eleme
饿了么移动端单页应用
Stars: ✭ 99 (+518.75%)
Mutual labels:  vue2, vue-router2
Vue2 Vue Router2 Webpack2
《从零搭建 vue2 vue-router2 webpack4 工程》《从零搭建 vue2 vue-router2 webpack3 工程》《搭建 vue2 vue-router2 webpack3 多入口工程》
Stars: ✭ 90 (+462.5%)
Mutual labels:  vue2, vue-router2
mpvue-netBar
use mpvue for find network
Stars: ✭ 16 (+0%)
Mutual labels:  vue2, vue-router2
Vue 2 Breadcrumbs
Vue breadcrumbs
Stars: ✭ 76 (+375%)
Mutual labels:  breadcrumbs, vue2
vue2-vue-router2-webpack
http://www.qinshenxue.com/article/20161106163608.html
Stars: ✭ 14 (-12.5%)
Mutual labels:  vue2, vue-router2
mobile
Go语言中文网移动端版本,使用 Vue.js(2.x) 构建
Stars: ✭ 35 (+118.75%)
Mutual labels:  vue2
vue-methods-promise
Let Vue methods support return Promise
Stars: ✭ 35 (+118.75%)
Mutual labels:  vue2
vue-taobao
基于 vue2 + vuex + mint-ui 构建一个单页面应用
Stars: ✭ 19 (+18.75%)
Mutual labels:  vue2
vue-ckeditor
✏️ Vue2.0 Ckeditor component.
Stars: ✭ 17 (+6.25%)
Mutual labels:  vue2
security-code
A powerful security code input supports dynamic configuration of the number of input boxes.
Stars: ✭ 63 (+293.75%)
Mutual labels:  vue2
vue-identify-network
⚡ Identify what kinda internet your users are using!
Stars: ✭ 60 (+275%)
Mutual labels:  vue2
firefly
Firefly is a mobile wallet for Stellar ecosystem
Stars: ✭ 54 (+237.5%)
Mutual labels:  vue2

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].