初始化 i18n时需要配置 legacy: false const i18n = createI18n({ /* 支持 composition Api使用 t */ legacy: false, allowComposition: true, locale, messages }) ; 组件内使用 import { useI18n } from 'vue-i18n'; const { t } = useI18n(); console.log(t("inputMessage.inputUsername"));