fix(i18n): 统一使用 useLazyTranslation 避免翻译 key 闪烁
This commit is contained in:
@@ -4,7 +4,7 @@ import ImageIcon from '@mui/icons-material/Image';
|
||||
import ClearIcon from '@mui/icons-material/Clear';
|
||||
import { qrCodePageStyles } from '@/config/pageTheme';
|
||||
import { useSnackbar } from '@/components/GlobalSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLazyTranslation } from '@/utils/useLazyTranslation';
|
||||
|
||||
interface ImageUploaderProps {
|
||||
/** 选中的文件 */
|
||||
@@ -32,7 +32,7 @@ const ImageUploader = ({
|
||||
dragging,
|
||||
onDraggingChange,
|
||||
}: ImageUploaderProps) => {
|
||||
const { t } = useTranslation(['qrCode']);
|
||||
const { t } = useLazyTranslation('qrCode');
|
||||
const { showMessage } = useSnackbar();
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Box, Button, Typography } from '@mui/material';
|
||||
import DownloadIcon from '@mui/icons-material/Download';
|
||||
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
|
||||
import { qrCodePageStyles } from '@/config/pageTheme';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLazyTranslation } from '@/utils/useLazyTranslation';
|
||||
|
||||
interface QrCodePreviewProps {
|
||||
/** 二维码 Data URL */
|
||||
@@ -14,7 +14,7 @@ interface QrCodePreviewProps {
|
||||
}
|
||||
|
||||
const QrCodePreview = ({ qrCodeDataUrl, onDownload, onCopy }: QrCodePreviewProps) => {
|
||||
const { t } = useTranslation(['qrCode']);
|
||||
const { t } = useLazyTranslation('qrCode');
|
||||
|
||||
if (!qrCodeDataUrl) {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user