Skip to content

Commit

Permalink
fix(Preview): fix style loading delay (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-Skyblue authored Jan 3, 2024
1 parent b1594d0 commit ece4414
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/output/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,8 @@ async function updatePreview() {
previewOptions?.bodyHTML || ''
}\``),
...modules,
`setTimeout(()=> {
document.querySelectorAll('style[css]').forEach(el => el.remove())
document.head.insertAdjacentHTML('beforeend', window.__css__.map(s => \`<style css>\${s}</style>\`).join('\\n'))
}, 1)`,
`document.querySelectorAll('style[css]').forEach(el => el.remove())
document.head.insertAdjacentHTML('beforeend', window.__css__.map(s => \`<style css>\${s}</style>\`).join('\\n'))`,
]
// if main file is a vue file, mount it.
Expand Down

0 comments on commit ece4414

Please sign in to comment.