我在 Nuxt 注册了 i18n。但我可以毫无错误地使用它。插值没有看到 $t 方法。我该如何解决?
对于模板中的类型,我只使用 JsDoc
编译确实有效,但我不想看到错误
错误:类型 'CombinedVueInstance<{ opensSubMenuId: any; 上不存在属性 '$t' } & { openSub(id: any): void; 关闭子():无效;} & { 导航:NavItem[]; 值:布尔值;} & Vue, 对象, 对象, 对象, Record<never, any>>'
Nuxt 配置
export default {
head: {
title: 'nuxt-football',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
css: ['@/assets/scss/_vars.scss', '@/assets/scss/main.scss'],
styleResources: {
scss: ['./assets/scss/*.scss'],
},
plugins: [],
components: {
dirs: [
'~/components',
{
path: '~/components/App/',
},
],
},
buildModules: ['@nuxtjs/eslint-module'],
modules: [
'@nuxtjs/axios',
'@nuxtjs/pwa',
'@nuxtjs/style-resources',
'nuxt-i18n',
],
i18n: {
defaultLocale: 'ru',
locales: [
{
code: 'ru',
file: 'ru-Ru.js',
},
],
lazy: true,
langDir: 'lang/',
},
axios: {},
build: {},
};