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