antvis / X6

🚀 JavaScript diagramming library that uses SVG and HTML for rendering.
https://x6.antv.antgroup.com
MIT License
5.79k stars 1.71k forks source link

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

Open wtjperi2003 opened 1 year ago

wtjperi2003 commented 1 year ago

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

Additional context

No response

lloydzhou commented 1 year ago

vue3请使用teleport模式渲染节点

whenTheMorningDark commented 1 year ago

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

whenTheMorningDark commented 1 year ago

vue3请使用teleport模式渲染节点

有例子吗?

NewByVector commented 1 year ago

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

fengxiaodong28 commented 6 months ago

@lloydzhou vue2的 可以使用teleport 吗?

lloydzhou commented 6 months ago

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