我正在尝试根据服务器返回的值显示通知。我不知道如何使用刚收到的键的值动态检索翻译值。
例如,error.response.data.errorDetailsCode的值为"invalid_credentials",转换为“提供的凭据无效”
import i18n from './i18n';
$.notify({message: i18n.t("error.response.data.errorDetailsCode")}, options);我在控制台上看到这样的警告:
vue-i18n.esm.js?a925:14 [vue-i18n] Cannot translate the value of keypath 'invalid_credentials'. Use the value of keypath as default.发布于 2019-03-02 00:00:59
终于找到了解决之道:
$.notify(message: i18n.t(`${error.response.data.errorDetailsCode}`)}, options);https://stackoverflow.com/questions/54947897
复制相似问题