From 791176a4855b9e407426c4039b5d3c72081767f0 Mon Sep 17 00:00:00 2001 From: zhangjingwei Date: Mon, 8 Apr 2024 16:42:51 +0800 Subject: [PATCH] feat: optimize menu display Adjust the maximum number of characters in the menu based on the current language Change-Id: I34e98bb6950105a7bb89a7671fcda93564349ad5 --- src/layouts/Base/Menu.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/Base/Menu.jsx b/src/layouts/Base/Menu.jsx index 20a7505f..057a37f9 100644 --- a/src/layouts/Base/Menu.jsx +++ b/src/layouts/Base/Menu.jsx @@ -20,10 +20,13 @@ import { toJS } from 'mobx'; import { isString, isEqual } from 'lodash'; import classnames from 'classnames'; import { getPath } from 'utils/route-map'; +import i18n from 'core/i18n'; import styles from './index.less'; const { SubMenu } = Menu; +const { getLocaleShortName } = i18n; + export class LayoutMenu extends Component { constructor(props) { super(props); @@ -32,7 +35,8 @@ export class LayoutMenu extends Component { hover: false, openKeys: [], }; - this.maxTitleLength = 17; + const shortName = getLocaleShortName(); + this.maxTitleLength = shortName === 'zh' ? 9 : 17; } componentDidMount() {