Skip to content

Commit

Permalink
Merge pull request #1066 from iview/2.0
Browse files Browse the repository at this point in the history
2.0
  • Loading branch information
Lison authored Nov 2, 2018
2 parents 36a0462 + e2c0b12 commit 80d132d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/libs/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const getBreadCrumbList = (route, homeRoute) => {
let routeMetched = route.matched
if (routeMetched.some(item => item.name === homeRoute.name)) return [homeItem]
let res = routeMetched.filter(item => {
return item.meta === undefined || !item.meta.hide
return item.meta === undefined || !item.meta.hideInBread
}).map(item => {
let meta = {...item.meta}
if (meta.title && typeof meta.title === 'function') meta.title = meta.title(route)
Expand Down Expand Up @@ -89,6 +89,7 @@ export const getRouteTitleHandled = (route) => {

export const showTitle = (item, vm) => {
let title = item.meta.title
if (!title) return
if (vm.$config.useI18n) {
if (title.includes('{{') && title.includes('}}') && vm.$config.useI18n) title = title.replace(/({{[\s\S]+?}})/, (m, str) => str.replace(/{{([\s\S]*)}}/, (m, _) => vm.$t(_.trim())))
else title = vm.$t(item.name)
Expand Down
14 changes: 9 additions & 5 deletions src/router/routers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import parentView from '@/components/parent-view'
* 显示在侧边栏、面包屑和标签栏的文字
* 使用'{{ 多语言字段 }}'形式结合多语言使用,例子看多语言的路由配置;
* 可以传入一个回调函数,参数是当前路由对象,例子看动态路由和带参路由
* hideInBread: (false) 设为true后此级路由将不会出现在面包屑中,示例看QQ群路由配置
* hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
* notCache: (false) 设为true后页面不会缓存
* access: (null) 可访问该页面的权限数组,当前路由设置的权限会影响子路由
Expand Down Expand Up @@ -62,6 +63,9 @@ export default [
path: '/join',
name: 'join',
component: Main,
meta: {
hideInBread: true
},
children: [
{
path: 'join_page',
Expand Down Expand Up @@ -210,7 +214,7 @@ export default [
path: '/tools_methods',
name: 'tools_methods',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
Expand All @@ -230,7 +234,7 @@ export default [
path: '/i18n',
name: 'i18n',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
Expand All @@ -249,7 +253,7 @@ export default [
path: '/error_store',
name: 'error_store',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
Expand All @@ -268,7 +272,7 @@ export default [
path: '/error_logger',
name: 'error_logger',
meta: {
hide: true,
hideInBread: true,
hideInMenu: true
},
component: Main,
Expand All @@ -288,7 +292,7 @@ export default [
path: '/directive',
name: 'directive',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
Expand Down

0 comments on commit 80d132d

Please sign in to comment.