// #ifdef MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO || MP-BAIDU // 小程序环境 Vue Devtools 兼容处理 (function() { try { // Vue 内部 getDevtoolsGlobalHook 会获取全局对象 // 并尝试访问 __VUE_DEVTOOLS_GLOBAL_HOOK__ // 在小程序中,globalThis 可能为 null 或不存在 // 获取全局对象的安全方式 var getGlobal = function() { if (typeof globalThis !== 'undefined' && globalThis !== null) { return globalThis; } if (typeof global !== 'undefined' && global !== null) { return global; } if (typeof window !== 'undefined' && window !== null) { return window; } // 小程序环境特殊处理 try { // eslint-disable-next-line no-new-func return Function('return this')(); } catch (e) { return null; } }; var _global = getGlobal(); if (_global) { // 确保 __VUE_DEVTOOLS_GLOBAL_HOOK__ 存在 if (!_global.__VUE_DEVTOOLS_GLOBAL_HOOK__) { _global.__VUE_DEVTOOLS_GLOBAL_HOOK__ = { enabled: false, addDevtools: function() {}, setupDevtoolsPlugin: function() {}, on: function() {}, once: function() {}, off: function() {}, emit: function() {} }; } } } catch (e) { console.warn('Polyfill __VUE_DEVTOOLS_GLOBAL_HOOK__ failed:', e); } })(); // #endif