【问题标题】:vue, i18n translation: $t in alert()vue, i18n 翻译:$t in alert()
【发布时间】:2021-08-05 12:46:20
【问题描述】:

我正在使用 Vue 2.6.14 和 vue-i18n 8.25 我不知道如何将 i18n 翻译放入 alert()...

 async ChangePassword() {               
       await axios.post('/api/reset-password', 
       this.form).then((response) => {                            
                 alert( {{ $t('Password changed') }} );  
                        })}

这似乎不起作用。

【问题讨论】:

  • 请提供stackoverflow.com/help/mcve。不知道你在哪里做的。
  • alert( this.$t('Password changed') );怎么样
  • 谢谢@BoussadjraBrahim!它有效!

标签: vue.js internationalization vue-i18n


【解决方案1】:

试试this

 alert( this.$t('Password changed') );

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-06
    • 2019-06-14
    • 2019-01-05
    • 1970-01-01
    • 1970-01-01
    • 2020-12-20
    相关资源
    最近更新 更多