Skip to content
New issue

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

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

Already on GitHub? # to your account

MetingJS v2.0.1 与 overlayscrollbars@1.13.1 存在冲突? #66

Open
ohmykreee opened this issue Oct 9, 2021 · 2 comments
Open

MetingJS v2.0.1 与 overlayscrollbars@1.13.1 存在冲突? #66

ohmykreee opened this issue Oct 9, 2021 · 2 comments

Comments

@ohmykreee
Copy link

  • 使用版本
    APlayer v1.10.1 af84efb
    MetingJS v2.0.1
    jquery@3.6.0

  • 现象
    APlayer 出现重复
    屏幕截图 2021-10-09 141224
    控制台报错(该报错重复三次):

Uncaught TypeError: Cannot read properties of undefined (reading 'destroy')
    at HTMLElement.disconnectedCallback (Meting.min.js:formatted:30)
    at xe (jquery@3.6.0:formatted:1872)
    at He (jquery@3.6.0:formatted:2284)
    at S.fn.init.append (jquery@3.6.0:formatted:2364)
    at S.fn.init.wrapAll (jquery@3.6.0:formatted:3838)
    at HTMLBodyElement.<anonymous> (jquery@3.6.0:formatted:3847)
    at Function.each (jquery@3.6.0:formatted:160)
    at S.fn.init.each (jquery@3.6.0:formatted:78)
    at S.fn.init.wrapInner (jquery@3.6.0:formatted:3844)
    at at (jquery.overlayScrollbars.min.js:13)

生成的 HTML 代码如下:
屏幕截图 2021-10-09 141939

取消使用 jQuery 后该问题不出现。

(我不会前端,js 代码也不会读,希望各位大佬能帮一帮忙)

@metowolf
Copy link
Owner

metowolf commented Oct 9, 2021

可以提供下能够复现的最小 html 代码

@ohmykreee
Copy link
Author

<!DOCTYPE html>

  <head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@1.13.1/css/OverlayScrollbars.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" />
    </head>

  <body class="default">
    <meting-js server="netease" type="song" id="1880127698"></meting-js>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0"></script>
    <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@1.13.1/js/jquery.overlayScrollbars.min.js"></script>
    <script src="/js/main.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js"></script>   
  </body>

</html>

由于原来的页面使用了模板,第 12 行的 main.js 来自 https://github.com/g1eny0ung/hugo-theme-dream/blob/master/static/js/main.js

所以分析下来其实并不是 MetingJS 和 jQuery 有冲突,而是模板里的其他 js 文件了?

@ohmykreee ohmykreee changed the title MetingJS v2.0.1 与 jquery@3.6.0 存在冲突? MetingJS v2.0.1 与 overlayscrollbars@1.13.1 存在冲突? Oct 19, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants