我正在将vuejs 3与TS一起使用。
我在TS中创建了这样的翻译文件:
index.ts:
export default {
'example': 'example',
}
为了以这种方式使用它:
{{ $t('example') }}
现在我想给翻译传递一个参数,比如:
index.ts:
export default {
'hi_man': 'Hi {name}', //where the name is the parameter
}
我该怎么做?
也许您应该考虑阅读文档:https://kazupon.github.io/vue-i18n/guide/formatting.html#named-格式化
<p>{{ $t('hi_man', { name: 'Monkey' }) }}</p>