MetingJS icon indicating copy to clipboard operation
MetingJS copied to clipboard

MetingJS v2.0.1 与 [email protected] 存在冲突?

Open ohmykreee opened this issue 4 years ago • 2 comments

  • 使用版本 APlayer v1.10.1 af84efb MetingJS v2.0.1 [email protected]

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

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

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

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

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

ohmykreee avatar Oct 09 '21 06:10 ohmykreee

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

metowolf avatar Oct 09 '21 08:10 metowolf

<!DOCTYPE html>

  <head>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/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/[email protected]"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/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 avatar Oct 09 '21 09:10 ohmykreee