feat: optimize menu display

Adjust the maximum number of characters in the menu based on the current language

Change-Id: I34e98bb6950105a7bb89a7671fcda93564349ad5
This commit is contained in:
zhangjingwei 2024-04-08 16:42:51 +08:00
parent 2c05f14a54
commit 791176a485

View File

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