Using $t in alert() for Vue's i18n translation
P粉757556355
P粉757556355 2023-08-26 16:36:42
0
1
391
<p>I'm using Vue 2.6.14 and vue-i18n 8.25 I can't figure out how to put the i18n translation in alert()...</p> <pre class="brush:php;toolbar:false;">async ChangePassword() { await axios.post('/api/reset-password', this.form).then((response) => { alert( {{ $t('Password has been changed') }} ); })}</pre> <p>This doesn't seem to work. </p>
P粉757556355
P粉757556355

reply all(1)
P粉403804844

Try using this

alert( this.$t('密码已更改') );
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!