From a3938b27db9fa52fca1ed9de38c687ae399c856e Mon Sep 17 00:00:00 2001 From: ULIVZ <472590061@qq.com> Date: Sun, 18 Nov 2018 07:29:02 +0800 Subject: [PATCH] fix($core): NodeList.prototype.forEach doesn't exist in IE11 --- .../@vuepress/core/lib/app/root-mixins/updateLoadingState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js b/packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js index 5257437922..899fe7441d 100644 --- a/packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js +++ b/packages/@vuepress/core/lib/app/root-mixins/updateLoadingState.js @@ -1,9 +1,9 @@ export default { created () { this.$vuepress.$on('AsyncMarkdownContentMounted', () => { - this.$vuepress.$set('contentMounted', true) + this.$vuepress.$set('contentMounted', true); - document.querySelectorAll('a[href^="#"]').forEach(anchor => { + [].slice.call(document.querySelectorAll('a[href^="#"]')).forEach(anchor => { anchor.addEventListener('click', function (e) { e.preventDefault() history.pushState(history.state, document.title, e.target.href)