Merge pull request #1066 from iview/2.0

2.0
This commit is contained in:
Lison 2018-11-02 11:58:26 +08:00 committed by GitHub
commit 80d132d13f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -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)
@ -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)

View File

@ -8,6 +8,7 @@ import parentView from '@/components/parent-view'
* 显示在侧边栏面包屑和标签栏的文字
* 使用'{{ 多语言字段 }}'形式结合多语言使用例子看多语言的路由配置;
* 可以传入一个回调函数参数是当前路由对象例子看动态路由和带参路由
* hideInBread: (false) 设为true后此级路由将不会出现在面包屑中示例看QQ群路由配置
* hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
* notCache: (false) 设为true后页面不会缓存
* access: (null) 可访问该页面的权限数组当前路由设置的权限会影响子路由
@ -62,6 +63,9 @@ export default [
path: '/join',
name: 'join',
component: Main,
meta: {
hideInBread: true
},
children: [
{
path: 'join_page',
@ -210,7 +214,7 @@ export default [
path: '/tools_methods',
name: 'tools_methods',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
@ -230,7 +234,7 @@ export default [
path: '/i18n',
name: 'i18n',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
@ -249,7 +253,7 @@ export default [
path: '/error_store',
name: 'error_store',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [
@ -268,7 +272,7 @@ export default [
path: '/error_logger',
name: 'error_logger',
meta: {
hide: true,
hideInBread: true,
hideInMenu: true
},
component: Main,
@ -288,7 +292,7 @@ export default [
path: '/directive',
name: 'directive',
meta: {
hide: true
hideInBread: true
},
component: Main,
children: [