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

vue2.x typescript 无法渲染自定义组件,疑似错误的引用了vue-router,推测$router全局污染?因为我看x6源码中有router相关声明 #1947

Closed
viewerzhang opened this issue Mar 28, 2022 · 7 comments
Assignees
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems

Comments

@viewerzhang
Copy link

Describe the bug

在vue2.x 版本script语法中正常使用,但是在vue2.x ts语法中报告router错误。
在Graph.registerNode时并没有报错
报错时机在graph.addNode({...node})是
WX20220328-150224@2x
1

Your Example Website or App

Steps to Reproduce the Bug or Issue

如上所示

Expected behavior

正常

Screenshots or Videos

No response

Platform

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

Additional context

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Mar 28, 2022

👋 @xzhz

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.

@viewerzhang viewerzhang changed the title vue2.x typescript 无法渲染自定义组件,疑似vue-router引用错误的vue-router vue2.x typescript 无法渲染自定义组件,疑似错误的引用了vue-router,推测$router全局污染?因为我看x6源码中有router相关声明 Mar 28, 2022
@NewByVector
Copy link
Contributor

x6 的 router 和 页面路由不是一回事,可以给个复现的 demo。

@NewByVector NewByVector self-assigned this Apr 9, 2022
@NewByVector NewByVector added the resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems label Apr 21, 2022
@chafel
Copy link

chafel commented May 23, 2022

@xzhz hi, 遇到了相同问题,请问解决了吗?跟 x6 有关系吗?

@lloydzhou
Copy link
Contributor

@xzhz @chafel

  1. 你在整个入口文件使用了Vue.use(VueRouter)
  2. customnode组件里面引用$route
  3. 但是vue-shape-view在渲染的时候实际上是动态的new Vue(...)然后mount到节点内部。这个动态new出来的Vue对象内部的组件自然不能访问$route

@NewByVector
Copy link
Contributor

@lloydzhou 使用你的 teleport 方案能否访问到 $router 呢?

@lloydzhou
Copy link
Contributor

@lloydzhou 使用你的 teleport 方案能否访问到 $router 呢?

新版本的x6-vue-shape内部的useTeleport在vue3下起作用,vue2.x不支持。

如果vue3.x,使用useTeleport应该是可以的。

@x6-bot
Copy link
Contributor

x6-bot bot commented Jul 8, 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 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems
Projects
None yet
Development

No branches or pull requests

4 participants