-
-
Save DezChuang/c8d3a048b5ca28aa000ce1ae13b90690 to your computer and use it in GitHub Desktop.
Force Open Vue Devtools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(() => { | |
// find root element: nuxt instance, #app, first div child in <body> | |
const root = window?.$nuxt?.$el || document.getElementById('app') || [...document.body.children].find(i => i.tagName === 'DIV'); | |
const app = root?.__vue__; | |
if (!app || !window.__VUE_DEVTOOLS_GLOBAL_HOOK__) return 0; | |
const Vue = app.constructor; | |
const VueSuper = Vue.super || Vue; | |
VueSuper.config.devtools = true; | |
window.__VUE_DEVTOOLS_GLOBAL_HOOK__.Vue = VueSuper; | |
})() | |
/* bookmarklet | |
javascript:(function()%7Bconst%20root%20%3D%20window%3F.%24nuxt%3F.%24el%20%7C%7C%20document.getElementById('app')%20%7C%7C%20%5B...document.body.children%5D.find(i%20%3D%3E%20i.tagName%20%3D%3D%3D%20'DIV')%3Bconst%20app%20%3D%20root%3F.__vue__%3Bif%20(!app%20%7C%7C%20!window.__VUE_DEVTOOLS_GLOBAL_HOOK__)%20return%200%3Bconst%20Vue%20%3D%20app.constructor%3Bconst%20VueSuper%20%3D%20Vue.super%20%7C%7C%20Vue%3BVueSuper.config.devtools%20%3D%20true%3Bwindow.__VUE_DEVTOOLS_GLOBAL_HOOK__.Vue%20%3D%20VueSuper%7D)() | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment