From 9c59282dad0d84e6c8ef3d3f9e48d72477ad4e5c Mon Sep 17 00:00:00 2001 From: saltysugar Date: Sat, 14 Sep 2019 20:05:18 +0800 Subject: [PATCH] Use setTimeout --- packages/saber-plugin-code-copy/lib/saber-browser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/saber-plugin-code-copy/lib/saber-browser.js b/packages/saber-plugin-code-copy/lib/saber-browser.js index b510a2026..54fa67a63 100644 --- a/packages/saber-plugin-code-copy/lib/saber-browser.js +++ b/packages/saber-plugin-code-copy/lib/saber-browser.js @@ -1,7 +1,7 @@ /* eslint-env browser */ /* globals __CODE_COPY_OPTIONS__ */ -export default ({ router, Vue }) => { +export default ({ router }) => { if (process.browser) { const copy = require('modern-copy').default @@ -43,7 +43,7 @@ export default ({ router, Vue }) => { } router.afterEach(() => { - Vue.nextTick(() => { + setTimeout(() => { forEach(document.querySelectorAll('.saber-highlight'), el => { if (el.dataset.hasCopy) return el.dataset.hasCopy = true @@ -64,7 +64,7 @@ export default ({ router, Vue }) => { injectStyle() el.append(copyButton) }) - }) + }, 100) }) } }