ソースを参照

fix: fix config.productionTip

fix #7565
Evan You 8 年 前
コミット
ced00b1dec
1 ファイル変更24 行追加22 行削除
  1. 24 22
      src/platforms/web/runtime/index.js

+ 24 - 22
src/platforms/web/runtime/index.js

@@ -44,32 +44,34 @@ Vue.prototype.$mount = function (
 
 // devtools global hook
 /* istanbul ignore next */
-Vue.nextTick(() => {
-  if (config.devtools) {
-    if (devtools) {
-      devtools.emit('init', Vue)
-    } else if (
-      process.env.NODE_ENV !== 'production' &&
+if (inBrowser) {
+  setTimeout(() => {
+    if (config.devtools) {
+      if (devtools) {
+        devtools.emit('init', Vue)
+      } else if (
+        process.env.NODE_ENV !== 'production' &&
+        process.env.NODE_ENV !== 'test' &&
+        isChrome
+      ) {
+        console[console.info ? 'info' : 'log'](
+          'Download the Vue Devtools extension for a better development experience:\n' +
+          'https://github.com/vuejs/vue-devtools'
+        )
+      }
+    }
+    if (process.env.NODE_ENV !== 'production' &&
       process.env.NODE_ENV !== 'test' &&
-      isChrome
+      config.productionTip !== false &&
+      typeof console !== 'undefined'
     ) {
       console[console.info ? 'info' : 'log'](
-        'Download the Vue Devtools extension for a better development experience:\n' +
-        'https://github.com/vuejs/vue-devtools'
+        `You are running Vue in development mode.\n` +
+        `Make sure to turn on production mode when deploying for production.\n` +
+        `See more tips at https://vuejs.org/guide/deployment.html`
       )
     }
-  }
-  if (process.env.NODE_ENV !== 'production' &&
-    process.env.NODE_ENV !== 'test' &&
-    config.productionTip !== false &&
-    inBrowser && typeof console !== 'undefined'
-  ) {
-    console[console.info ? 'info' : 'log'](
-      `You are running Vue in development mode.\n` +
-      `Make sure to turn on production mode when deploying for production.\n` +
-      `See more tips at https://vuejs.org/guide/deployment.html`
-    )
-  }
-}, 0)
+  }, 0)
+}
 
 export default Vue