perf[Breadcrumb]: set noredirect => noRedirect
This commit is contained in:
parent
067a2910d4
commit
4ee334ad83
|
@ -129,7 +129,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/components',
|
path: '/components',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
name: 'ComponentDemo',
|
name: 'ComponentDemo',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'components',
|
title: 'components',
|
||||||
|
@ -225,7 +225,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/charts',
|
path: '/charts',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
name: 'Charts',
|
name: 'Charts',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'charts',
|
title: 'charts',
|
||||||
|
@ -361,7 +361,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/error',
|
path: '/error',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
name: 'ErrorPages',
|
name: 'ErrorPages',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'errorPages',
|
title: 'errorPages',
|
||||||
|
@ -386,7 +386,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/error-log',
|
path: '/error-log',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'log',
|
path: 'log',
|
||||||
|
@ -472,7 +472,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/theme',
|
path: '/theme',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
|
@ -486,7 +486,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/clipboard',
|
path: '/clipboard',
|
||||||
component: 'layout/Layout',
|
component: 'layout/Layout',
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<el-breadcrumb class="app-breadcrumb" separator="/">
|
<el-breadcrumb class="app-breadcrumb" separator="/">
|
||||||
<transition-group name="breadcrumb">
|
<transition-group name="breadcrumb">
|
||||||
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
|
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
|
||||||
<span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{
|
<span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{
|
||||||
generateTitle(item.meta.title) }}</span>
|
generateTitle(item.meta.title) }}</span>
|
||||||
<a v-else @click.prevent="handleLink(item)">{{ generateTitle(item.meta.title) }}</a>
|
<a v-else @click.prevent="handleLink(item)">{{ generateTitle(item.meta.title) }}</a>
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
|
@ -31,6 +31,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
generateTitle,
|
generateTitle,
|
||||||
getBreadcrumb() {
|
getBreadcrumb() {
|
||||||
|
// only show routes with name
|
||||||
let matched = this.$route.matched.filter(item => item.name)
|
let matched = this.$route.matched.filter(item => item.name)
|
||||||
|
|
||||||
const first = matched[0]
|
const first = matched[0]
|
||||||
|
|
|
@ -121,7 +121,7 @@ export default {
|
||||||
|
|
||||||
data.title = [...data.title, i18ntitle]
|
data.title = [...data.title, i18ntitle]
|
||||||
|
|
||||||
if (router.redirect !== 'noredirect') {
|
if (router.redirect !== 'noRedirect') {
|
||||||
// only push the routes with title
|
// only push the routes with title
|
||||||
// special case: need to exclude parent router without redirect
|
// special case: need to exclude parent router without redirect
|
||||||
res.push(data)
|
res.push(data)
|
||||||
|
|
|
@ -20,7 +20,7 @@ import nestedRouter from './modules/nested'
|
||||||
* alwaysShow: true if set true, will always show the root menu
|
* alwaysShow: true if set true, will always show the root menu
|
||||||
* if not set alwaysShow, when item has more than one children route,
|
* if not set alwaysShow, when item has more than one children route,
|
||||||
* it will becomes nested mode, otherwise not show the root menu
|
* it will becomes nested mode, otherwise not show the root menu
|
||||||
* redirect: noredirect if `redirect:noredirect` will no redirect in the breadcrumb
|
* redirect: noRedirect if set noRedirect will no redirect in the breadcrumb
|
||||||
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
* name:'router-name' the name is used by <keep-alive> (must set!!!)
|
||||||
* meta : {
|
* meta : {
|
||||||
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
roles: ['admin','editor'] control the page roles (you can set multiple roles)
|
||||||
|
@ -224,7 +224,7 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/error',
|
path: '/error',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
name: 'ErrorPages',
|
name: 'ErrorPages',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'errorPages',
|
title: 'errorPages',
|
||||||
|
@ -249,7 +249,6 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/error-log',
|
path: '/error-log',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'noredirect',
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'log',
|
path: 'log',
|
||||||
|
@ -336,7 +335,6 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/theme',
|
path: '/theme',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'noredirect',
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
|
@ -350,7 +348,6 @@ export const asyncRoutes = [
|
||||||
{
|
{
|
||||||
path: '/clipboard',
|
path: '/clipboard',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'noredirect',
|
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Layout from '@/layout'
|
||||||
const chartsRouter = {
|
const chartsRouter = {
|
||||||
path: '/charts',
|
path: '/charts',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
name: 'Charts',
|
name: 'Charts',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'charts',
|
title: 'charts',
|
||||||
|
|
|
@ -5,7 +5,7 @@ import Layout from '@/layout'
|
||||||
const componentsRouter = {
|
const componentsRouter = {
|
||||||
path: '/components',
|
path: '/components',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'noredirect',
|
redirect: 'noRedirect',
|
||||||
name: 'ComponentDemo',
|
name: 'ComponentDemo',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'components',
|
title: 'components',
|
||||||
|
|
Loading…
Reference in New Issue