chore: 更新版本至 5.1.6,修复样式加载失败问题并优化样式插入逻辑

This commit is contained in:
Harvey Zack committed 2025-01-19 20:50:26 +08:00
1 parent c89b9e7871
commit 4b4973eeb3
9 files changed
+45 -32

No files matched your search

+11 -7
View File
@@ -186,15 +186,19 @@ export default function artplayerPluginChapter(option = {}) {
if (typeof document !== 'undefined') {
const id = 'artplayer-plugin-chapter';
const $style = document.getElementById(id);
if ($style) {
$style.textContent = style;
} else {
const $style = document.createElement('style');
let $style = document.getElementById(id);
if (!$style) {
$style = document.createElement('style');
$style.id = id;
$style.textContent = style;
document.head.appendChild($style);
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
document.head.appendChild($style);
});
} else {
(document.head || document.documentElement).appendChild($style);
}
}
$style.textContent = style;
}
if (typeof window !== 'undefined') {