共计 286 个字符,预计需要花费 1 分钟才能阅读完成。
<Trans i18nKey={'app.btn.setIcon'} defaults={'设置图标'} />
i18nKey 是 对应翻译文件的key,defaults 是默认值,就是找不到翻译文件的时候显示的默认内容
// t 的用法
{t('common.button.cancel', { defaultValue: '取消 {{name}}', name: iconPath })}
第一个参数 common.button.cancel 为翻译文件的key,defaultValue 是找不到翻译时候显示的默认内容, name 的对应 defaultValue 里面的 {{name}} 动态值,他会知道替换里面的内容
正文完