mirror of https://github.com/jeecgboot/jeecg-boot
【issues/8317】菜单管理页首页国际化报错 ---
parent
69b2e97935
commit
3c0cc49f0c
|
@ -1,4 +1,5 @@
|
||||||
export default {
|
export default {
|
||||||
login: 'Login',
|
login: 'Login',
|
||||||
errorLogList: 'Error Log',
|
errorLogList: 'Error Log',
|
||||||
|
defaultHomePage: 'Default Home Page',
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export default {
|
export default {
|
||||||
login: '登录',
|
login: '登录',
|
||||||
errorLogList: '错误日志列表',
|
errorLogList: '错误日志列表',
|
||||||
|
defaultHomePage: '默认首页',
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,18 +48,29 @@
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
// 自定义菜单名称列渲染
|
// 自定义菜单名称列渲染
|
||||||
columns[0].customRender = function ({text, record}) {
|
columns[0].customRender = function ({ text, record }) {
|
||||||
const isDefIndex = checkDefIndex(record)
|
// date-begin--author:liaozhiyang---date:20250716---for:【issues/8317】默认首页菜单名称适配国际化报错
|
||||||
if (isDefIndex) {
|
let displayText = text;
|
||||||
text += '(默认首页)'
|
|
||||||
}
|
|
||||||
// update-begin--author:liaozhiyang---date:20240306---for:【QQYUN-8379】菜单管理页菜单国际化
|
// update-begin--author:liaozhiyang---date:20240306---for:【QQYUN-8379】菜单管理页菜单国际化
|
||||||
if (text.includes("t('") && t) {
|
// 先处理国际化,避免在添加默认首页标记后影响国际化检查
|
||||||
return new Function('t', `return ${text}`)(t);
|
if (displayText && displayText.includes("t('") && t) {
|
||||||
|
try {
|
||||||
|
displayText = new Function('t', `return ${displayText}`)(t);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('国际化处理失败:', error);
|
||||||
|
// 如果国际化处理失败,使用原始文本
|
||||||
|
displayText = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// update-end--author:liaozhiyang---date:20240306---for:【QQYUN-8379】菜单管理页菜单国际化
|
// update-end--author:liaozhiyang---date:20240306---for:【QQYUN-8379】菜单管理页菜单国际化
|
||||||
return text
|
// 在国际化处理完成后,再添加默认首页标记
|
||||||
|
const isDefIndex = checkDefIndex(record);
|
||||||
|
if (isDefIndex) {
|
||||||
|
displayText += `(${t('routes.basic.defaultHomePage')})`;
|
||||||
}
|
}
|
||||||
|
return displayText;
|
||||||
|
// date-end--author:liaozhiyang---date:20250716---for:【issues/8317】默认首页菜单名称适配国际化报错
|
||||||
|
};
|
||||||
|
|
||||||
// 列表页面公共参数、方法
|
// 列表页面公共参数、方法
|
||||||
const { prefixCls, tableContext } = useListPage({
|
const { prefixCls, tableContext } = useListPage({
|
||||||
|
|
Loading…
Reference in New Issue