Blogs Projects

「Enable Vue devtools in Production」

·

  1. Press F12 to open devtool console page.
  2. Execute following code:

Vue2.x

const app = Array.from(document.querySelector('*')).find(
  e => e.__vue__
).__vue__
const devtools = window.__VUE_DEVTOOLS_GLOBAL_HOOK__
const Vue = Object.getPrototypeOf(app).constructor
while (Vue.super)
  Vue = Vue.super

Vue.config.devtools = true
devtools.emit('init', Vue)

Vue3.x

const app = Array.from(document.querySelector('*')).find(
  e => e.__vue_app__
).__vue_app__
const version = app.version
const devtools = window.__VUE_DEVTOOLS_GLOBAL_HOOK__
devtools.enabled = true
devtools.emit('app:init', app, version, {})
  1. Press Option/Alt + R to refresh the devtool, now you can see the Vue tab is show.

Or install Chrome extension Vue force dev

Prev
Javascript中的深拷贝与浅拷贝
Next
Git多用户管理