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

g2 在IE11浏览器上运行空白,报错 #5394

Closed
Azariasa opened this issue Aug 15, 2023 · 7 comments
Closed

g2 在IE11浏览器上运行空白,报错 #5394

Azariasa opened this issue Aug 15, 2023 · 7 comments
Assignees
Labels

Comments

@Azariasa
Copy link

  • G2 Version: 5.0.12
  • Platform: windows
  • Mini Showcase(like screenshots):
  • CodePen Link:

g2在低代码平台中引入,项目打包后再IE11浏览器上运行空白,报错信息如下:

image

报错信息代码为:

跟踪代码,变量值this为:
image

@hustcc
Copy link
Member

hustcc commented Aug 15, 2023

还有更详细的具体代码截图吗?

@Azariasa
Copy link
Author

Azariasa commented Aug 15, 2023

这个是源码报错的截图:

Snipaste_2023-08-15_09-42-51

@pearmini
Copy link
Member

这里的 this 是 g 的 element,style 是一个 proxy,@xiaoiver 看看?

@xiaoiver
Copy link
Contributor

xiaoiver commented Aug 16, 2023

Proxy 是 ES6 的特性,我们使用它支持 shape.style.xx = 2 这样的语法:
https://stackoverflow.com/a/45453750

如果想支持 IE11,可能有两种方式:

  1. 让使用者在构建流程中尝试引入 Polyfill:https://github.com/GoogleChrome/proxy-polyfill
  2. G2 GUI 避免使用上面的语法,改成 shape.attr({ xx: 2 })

@Azariasa 可否先尝试一下第一种方案?我们再讨论一下第二种方式

@hustcc
Copy link
Member

hustcc commented Aug 16, 2023

Proxy 的浏览器兼容好像就是到 IE11,不过 vue 3.0 也是使用的这个。

下图发现 mdn 已经不显示 ie 的兼容性了。

image

@Azariasa
Copy link
Author

Azariasa commented Aug 17, 2023

让使用者在构建流程中尝试引入 Polyfill:https://github.com/GoogleChrome/proxy-polyfill

因我们项目是打包之后在IE11中运行,我将此项目中的 proxy.min.js 引入页面,还是会报同样的错。

页面引入方式如下:
Snipaste_2023-08-15_09-42-51

@xiaoiver

@pearmini
Copy link
Member

pearmini commented Sep 8, 2023

把项目的 target 打包的 target 设置成 es5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants