commit
84e10d6154
|
|
@ -9,7 +9,7 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { showTitle } from '_c/common/util'
|
||||
import { showTitle } from '@/libs/util'
|
||||
import CommonIcon from '_c/common-icon'
|
||||
import './custom-bread-crumb.less'
|
||||
export default {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import CommonIcon from '_c/common-icon'
|
||||
import { showTitle } from '@/libs/util'
|
||||
export default {
|
||||
components: {
|
||||
CommonIcon
|
||||
},
|
||||
methods: {
|
||||
showTitle (item) {
|
||||
return this.$config.useI18n ? this.$t(item.name) : ((item.meta && item.meta.title) || item.name)
|
||||
return showTitle(item, this)
|
||||
},
|
||||
showChildren (item) {
|
||||
return item.children && (item.children.length > 1 || (item.meta && item.meta.showAlways))
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export default {
|
|||
plugin: {
|
||||
'error-store': {
|
||||
showInHeader: true, // 设为false后不会在顶部显示错误日志徽标
|
||||
developmentOff: false // 设为true后在开发环境不会收集错误信息,方便开发中排查错误
|
||||
developmentOff: true // 设为true后在开发环境不会收集错误信息,方便开发中排查错误
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,15 +74,27 @@ export const getBreadCrumbList = (route, homeRoute) => {
|
|||
return [{...homeItem, to: homeRoute.path}, ...res]
|
||||
}
|
||||
|
||||
export const getRouteTitleHandled = route => {
|
||||
export const getRouteTitleHandled = (route) => {
|
||||
let router = {...route}
|
||||
let meta = {...route.meta}
|
||||
if (meta.title && typeof meta.title === 'function') meta.title = meta.title(router)
|
||||
let title = ''
|
||||
if (meta.title) {
|
||||
if (typeof meta.title === 'function') title = meta.title(router)
|
||||
else title = meta.title
|
||||
}
|
||||
meta.title = title
|
||||
router.meta = meta
|
||||
return router
|
||||
}
|
||||
|
||||
export const showTitle = (item, vm) => vm.$config.useI18n ? vm.$t(item.name) : ((item.meta && item.meta.title) || item.name)
|
||||
export const showTitle = (item, vm) => {
|
||||
let title = item.meta.title
|
||||
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)
|
||||
} else title = (item.meta && item.meta.title) || item.name
|
||||
return title
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 本地存储和获取标签导航列表
|
||||
|
|
|
|||
|
|
@ -32,5 +32,7 @@ export default {
|
|||
buttonText: 'Show Modal',
|
||||
'i18n-tip': 'Note: Only this page is multi-language, other pages do not add language content to the multi-language package.',
|
||||
error_store_page: 'Error Collection',
|
||||
error_logger_page: 'Error Logger'
|
||||
error_logger_page: 'Error Logger',
|
||||
query: 'Query',
|
||||
params: 'Params'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ export default {
|
|||
buttonText: '显示模态框',
|
||||
'i18n-tip': '注:仅此页做了多语言,其他页面没有在多语言包中添加语言内容',
|
||||
error_store_page: '错误收集',
|
||||
error_logger_page: '错误日志'
|
||||
|
||||
error_logger_page: '错误日志',
|
||||
query: '带参路由',
|
||||
params: '动态路由'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,5 +32,7 @@ export default {
|
|||
buttonText: '顯示模態框',
|
||||
'i18n-tip': '注:僅此頁做了多語言,其他頁面沒有在多語言包中添加語言內容',
|
||||
error_store_page: '錯誤收集',
|
||||
error_logger_page: '錯誤日誌'
|
||||
error_logger_page: '錯誤日誌',
|
||||
query: '帶參路由',
|
||||
params: '動態路由'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ import parentView from '@/components/parent-view'
|
|||
/**
|
||||
* iview-admin中meta除了原生参数外可配置的参数:
|
||||
* meta: {
|
||||
* title: { String|Number|Function }
|
||||
* 显示在侧边栏、面包屑和标签栏的文字
|
||||
* 使用'{{ 多语言字段 }}'形式结合多语言使用,例子看多语言的路由配置;
|
||||
* 可以传入一个回调函数,参数是当前路由对象,例子看动态路由和带参路由
|
||||
* hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
|
||||
* notCache: (false) 设为true后页面不会缓存
|
||||
* access: (null) 可访问该页面的权限数组,当前路由设置的权限会影响子路由
|
||||
|
|
@ -235,7 +239,7 @@ export default [
|
|||
name: 'i18n_page',
|
||||
meta: {
|
||||
icon: 'md-planet',
|
||||
title: '国际化'
|
||||
title: 'i18n - {{ i18n_page }}'
|
||||
},
|
||||
component: () => import('@/view/i18n/i18n-page.vue')
|
||||
}
|
||||
|
|
@ -363,7 +367,7 @@ export default [
|
|||
name: 'params',
|
||||
meta: {
|
||||
icon: 'md-flower',
|
||||
title: route => `动态路由-${route.params.id}`,
|
||||
title: route => `{{ params }}-${route.params.id}`,
|
||||
notCache: true,
|
||||
beforeCloseName: 'before_close_normal'
|
||||
},
|
||||
|
|
@ -374,7 +378,7 @@ export default [
|
|||
name: 'query',
|
||||
meta: {
|
||||
icon: 'md-flower',
|
||||
title: route => `带参路由-${route.query.id}`,
|
||||
title: route => `{{ query }}-${route.query.id}`,
|
||||
notCache: true
|
||||
},
|
||||
component: () => import('@/view/argu-page/query.vue')
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ export default {
|
|||
name: 'tools_methods_page',
|
||||
methods: {
|
||||
...mapMutations([
|
||||
'addTag',
|
||||
'closeTag'
|
||||
]),
|
||||
createTagParams () {
|
||||
|
|
|
|||
Loading…
Reference in New Issue