From 780c1e580e6c598703cfae381cb537b8c5849c7d Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Mon, 20 Feb 2017 08:57:09 +0800 Subject: [PATCH] fix(render): execute script --- src/core/config.js | 2 +- src/core/render/index.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/config.js b/src/core/config.js index ceba2150c..2cccfc503 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -15,7 +15,7 @@ const config = merge({ themeColor: '', nameLink: window.location.pathname, autoHeader: false, - executeScript: false, + executeScript: null, ga: '' }, window.$docsify) diff --git a/src/core/render/index.js b/src/core/render/index.js index 7985a38ca..b2907ab4c 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -28,9 +28,8 @@ function renderMain (html) { this._renderTo('.markdown-section', html) // Render sidebar with the TOC !this.config.loadSidebar && this._renderSidebar() - // execute script - this.config.executeScript && executeScript() + // execute script if (this.config.executeScript !== false && typeof window.Vue !== 'undefined' && !executeScript()) { @@ -39,6 +38,8 @@ function renderMain (html) { vueVM && vueVM.$destroy && vueVM.$destroy() window.__EXECUTE_RESULT__ = new window.Vue().$mount('#main') }, 0) + } else { + this.config.executeScript && executeScript() } if (this.config.auto2top) {