开启vue dev

open the vue devtools

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         开启vue dev
// @namespace    http://tampermonkey.net/
// @version      2025-06-17
// @description  open the vue devtools
// @author       mrwhat
// @license MI
// @match        https://github.com/EHfive/userscripts
// @icon         https://www.google.com/s2/favicons?sz=64&domain=github.com
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';
    if (document && document.documentElement && document.documentElement.appendChild) {
        const script = document.createElement('script');
        script.textContent = `
            try {
                let _init_ = () => {
                    console.log('启动注入')
                    const doc = Array.from(document.querySelectorAll('*')).find((e) => e.__vue_app__) || document.querySelector("#app")
                    if (!doc) return;
                    const app = doc.__vue_app__;
                    const version = app.version;
                    console.log('发现vue.js', version);

                    const devtools = window.__VUE_DEVTOOLS_GLOBAL_HOOK__
                    devtools.enabled = true

                    devtools.emit('app:init', app, version, {})
                }

                const button = document.createElement('button')
                button.id = '_hacking_'
                button.innerHTML = '注入dev'
                button.addEventListener('click', _init_)
                button.style.position = 'fixed'
                button.style.top = '0'
                button.style.right = '0'
                button.style.zIndex = '1000'
                button.style.cursor = 'pointer'
                document.body.appendChild(button)
            } catch (e) {
            }
        `
        document.documentElement.appendChild(script);
        script.remove();
    }
})();