Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue类型节点内部国际化依赖报错 #3954

Open
wtjperi2003 opened this issue Oct 6, 2023 · 6 comments
Open

vue类型节点内部国际化依赖报错 #3954

wtjperi2003 opened this issue Oct 6, 2023 · 6 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@wtjperi2003
Copy link

Describe the bug

vue节点内部,使用const {t}=useI18n();运行时会报下列错误:

runtime-core.esm-bundler.js:221 Uncaught SyntaxError: Need to install with `app.use` function (at message-compiler.esm-bundler.js:54:19)
    at createCompileError (message-compiler.esm-bundler.js:54:19)
    at createI18nError (vue-i18n.esm-bundler.js:100:12)
    at useI18n (vue-i18n.esm-bundler.js:2219:15)
    at setup (dynamicChart.vue:19:1)
    at callWithErrorHandling (runtime-core.esm-bundler.js:158:18)
    at setupStatefulComponent (runtime-core.esm-bundler.js:7236:25)
    at setupComponent (runtime-core.esm-bundler.js:7197:36)
    at mountComponent (runtime-core.esm-bundler.js:5599:7)
    at processComponent (runtime-core.esm-bundler.js:5565:9)
    at patch (runtime-core.esm-bundler.js:5040:11)

实际上再main.ts里已经app.use(i18n)了。

Your Example Website or App

暂时没有

Steps to Reproduce the Bug or Issue

vue3项目安装"vue-i18n": "9"依赖,main.ts里安装文档启用:

import { createApp } from 'vue'
import { createI18n } from 'vue-i18n'

const i18n = createI18n({
  // something vue-i18n options here ...
})

const app = createApp({
  // something vue options here ...
})

app.use(i18n)
app.mount('#app')

然后自定义一个vue节点,再里面const {t}=useI18n();
然后再graph里添加该节点

Expected behavior

能正常使用

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 2.11.1]

Additional context

No response

@lloydzhou
Copy link
Contributor

vue3请使用teleport模式渲染节点

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Oct 9, 2023
@whenTheMorningDark
Copy link

老哥你解决了吗?我也遇到了相同问题 @wtjperi2003

@whenTheMorningDark
Copy link

vue3请使用teleport模式渲染节点

有例子吗?

@NewByVector
Copy link
Contributor

官网例子就是使用 teleport 模式。

@fengxiaodong28
Copy link

@lloydzhou vue2的 可以使用teleport 吗?

@lloydzhou
Copy link
Contributor

@fengxiaodong28
teleport是vue3的一个内置的组件。vue2中没有

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

5 participants