通过 vue-i18n 实现了多语言切换,在template里面已经实现了该功能,但是现在需要在 js 中 获取对应语言的字符,网上找了好久还是没找到,有人知道怎么弄么?
template 里面
{{ $t('message.exchangeCenter.exchangeDate') }}
js里面需要:需要把中文替换成多语言,求解
const exchangeTypes = [
{id: 1, text: '游戏币'},
{id: 2, text: '积分'}
];
js中写法:
const exchangeTypes = [
{id: 1, text: this.$t('xxx')},
{id: 2, text: this.$t('yyy')}
];
错误提示:
文档都是摆设么
http://kazupon.github.io/vue-...
定义好你的字符以后,代码中用
const exchangeTypes = [
];