vue-i18n this.$tc 不是一个函数

Vue*_*ion 6 vue.js vue-i18n

我的语言文件:

\n
AccountNotifications: {\n  createdWithName: 'Account \xc2\xab{account}\xc2\xbb created',\n  created: 'Account created | Accounts created',\n}\n
Run Code Online (Sandbox Code Playgroud)\n

我的提交方法

\n
submit() \n   this.$notifications.add({\n        type: 'success',\n        html: accounts.length === 1\n        ? this.$tc('AccountNotifications.created', 1)\n        : this.$tc('AccountNotifications.created', 2),\n  });\n
Run Code Online (Sandbox Code Playgroud)\n

我的输出

\n
app.js:290949 TypeError: this.$tc is not a function\n
Run Code Online (Sandbox Code Playgroud)\n

怎么了?

\n

Gee*_*key 9

实际上并不需要$tc()。$t() 函数现在支持复数形式。

  • 多谢!为此而自责。官方指南还没有更新,所以我很不明白为什么会发生这种情况。 (3认同)