Open Vue devtools

在检测到Vue.js环境时,打开vue开发工具的开关,便于调试生产环境下的Vue页面

اعتبارا من 15-06-2021. شاهد أحدث إصدار.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Open Vue devtools
// @namespace    http://tampermonkey.net/
// @version      0.4
// @description  在检测到Vue.js环境时,打开vue开发工具的开关,便于调试生产环境下的Vue页面
// @author       YUYIDM
// @match        http://*/*
// @match        https://*/*
// @icon         https://cn.vuejs.org/images/logo.svg
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function (g) {
    'use strict';

    function get() {
        return g.Vue;
    }

    function set(params) {
        //根据版本号判断全局Vue变量是否为Vue.js
        if (!params.version) {
            g.Vue = params;
            return;
        }
        console.log(
            `%c Tips: %c Vue ${params.version} %c`,
            'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff',
            'background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0;  color: #fff',
            'background:transparent'
        );
        // 打开vue-devtools
        params.config.devtools = true;
        g.Vue = params;
    }

    Object.defineProperty(window, 'Vue', { get, set });
})(Window);