Vue3 Typescript Vite使用国际化 Vue-i18n 报错 Cannot read properties of undefined (reading ‘__composer‘)

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘__composer’)
在这里插入图片描述

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '__composer')    vue-i18n.esm-bundler.js:1756 
    at Proxy.mounted (vue-i18n.esm-bundler.js:1756:52)
    at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
    at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2687:29)
    at flushPostFlushCbs (runtime-core.esm-bundler.js:358:32)
    at flushJobs (runtime-core.esm-bundler.js:403:9)

解决方案

在使用的时候`import { createI18n } from 'vue-i18n’会报错,改成下面这种方式就好了

import { createI18n } from 'vue-i18n/index';
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值