问题描述

使用 hexo-tag-aplayer插件后,博客最上方的导航栏在点击一次后会消失不见

F5页面刷新后导航栏能正常显示,但再次点击任一按钮后导航栏又消失不见。

查看控制台发现如下错误:

RangeError:Maximum call stack size exceeded at loadMeting栈溢出

问题解决

询问butterfly主题开发者 jerryc127 得到如下解决方案

修改主题 themes\butterfly\layout\includes\third-party\aplayer.pug文件如下

plaintext
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
link(rel='stylesheet' href=url_for(theme.asset.aplayer_css) media="print" onload="this.media='all'")
script(src=url_for(theme.asset.aplayer_js))
script(src=url_for(theme.asset.meting_js))
if theme.pjax.enable
script.
(() => {
const destroyAplayer = () => {
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
}

const runLoadMeting = () => {
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
}

btf.addGlobalFn('pjaxSend', destroyAplayer, 'destroyAplayer')
btf.addGlobalFn('pjaxComplete', loadMeting, 'runLoadMeting')
})()

问题解决。