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工程使用vue组件渲染节点,节点组件内无法获取i18n等父工程vue实例配置 #1864

Closed
tweet opened this issue Mar 2, 2022 · 5 comments
Labels
help wanted 需要认领 Issues to which we welcome contribution from the community

Comments

@tweet
Copy link

tweet commented Mar 2, 2022

问题描述

vue工程使用vue组件渲染节点,节点组件内无法获取i18n等父工程vue实例配置,期望节点组件可以重用父工程相关设置,这样可以统一代码调用风格,比如可以在父子工程均可以使用vue-i18n实例实现国际化相关功能。

以下为调用示例,无论使用vueparent还是i18n属性均会导致页面渲染报错

 Graph.registerNode("biz-node-ui", {
      inherit: "vue-shape",
      x: 200,
      y: 100,
      width: 200,
      height: 100,
      component: {
        // parent: this.$root,
        // i18n: this.$i18n, 
        template: "<biz-node />",
        components: {
          BizNode
        }
      }
    });

重现链接

不涉及

重现步骤

报错内容

vue.esm.js?a026:1906 TypeError: Cannot convert a Symbol value to a string
    at warnNonPresent (vue.esm.js?a026:2057:1)
    at Object.has (vue.esm.js?a026:2101:1)
    at baseGetTag (_baseGetTag.js?f0ce:23:1)
    at baseClone (_baseClone.js?09f4:112:1)
    at eval (_baseClone.js?09f4:161:1)
    at arrayEach (_arrayEach.js?20b6:15:1)
    at baseClone (_baseClone.js?09f4:155:1)
    at eval (_baseClone.js?09f4:161:1)

跟踪发现是@antv/x6/es/model/store.js行15需要对传入的数据做DeepClone报错

export class Store extends Basecoat {
    constructor(data = {}) {
        super();
        this.pending = false;
        this.changing = false;
        this.data = {};
        this.mutate(ObjectExt.cloneDeep(data));  // 报错行
        this.changed = {};
    }

预期行为

可以在x6的节点组件中正常使用vue父工程的相关功能,如国际化this.$t("xxx.locale")

平台

  • 操作系统: Windows
  • 网页浏览器: Edge
  • X6 版本: 1.30.0

屏幕截图或视频(可选)

No response

补充说明(可选)

期待能尽快功能完善

@x6-bot
Copy link
Contributor

x6-bot bot commented Mar 2, 2022

👋 @tweet

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@NewByVector NewByVector added the help wanted 需要认领 Issues to which we welcome contribution from the community label Mar 3, 2022
@x6-bot
Copy link
Contributor

x6-bot bot commented Mar 24, 2022

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not-stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the AntV community! 💪💯

@x6-bot x6-bot bot added the stale Issue that may be closed soon due to the original author not responding any more. label Mar 24, 2022
@NewByVector NewByVector removed the stale Issue that may be closed soon due to the original author not responding any more. label Mar 26, 2022
@lloydzhou
Copy link
Contributor

@tweet
#2075

所有的节点在当前的Vue App内部,渲染的时候使用Teleport将实际的UI渲染到node节点内部,应该能解决这个问题。

@NewByVector
Copy link
Contributor

更新到 v1.32.4 版本以上,使用 vue 的 teleport 方案,能解决上述问题。

@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 1, 2023

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Jul 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted 需要认领 Issues to which we welcome contribution from the community
Projects
None yet
Development

No branches or pull requests

3 participants