From 7995861193c8fc5fd0b2ddbfe59dd1be8363c40c Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Thu, 19 Jan 2023 18:09:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20ccxxx=20=E7=9A=84console?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=87=BD=E6=95=B0=EF=BC=8C=E8=BF=81=E7=A7=BB?= =?UTF-8?q?=E5=88=B0=E7=8B=AC=E7=AB=8B=E7=9A=84=20wo-core-coco=20=E9=87=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unitool.js | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/unitool.js b/unitool.js index f4826fa..a417a3c 100644 --- a/unitool.js +++ b/unitool.js @@ -34,34 +34,6 @@ export default { : getCurrentPages()[getCurrentPages().length - 1] || {} // [20220401] 发现在 topWindow 里, getCurrentPages 是 undefined。 // 在 App.vue 中调用 getCurrentPages() 返回的是空数组 [],因此在这里默认 {} 做保护。 }, - // 输出命令行提示,可用来取代 console.log/info/warn/error - cclog (...args) { - const pageName = this.thisPage()?.route || 'VueApp' - console.log('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:blue;background:lightgrey', ...args) - }, - ccinfo (...args) { - const pageName = this.thisPage()?.route || 'VueApp' - console.info('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:green;background:lightgrey', ...args) - }, - ccwarn (...args) { - const pageName = this.thisPage()?.route || 'VueApp' - console.warn('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:orange;background:lightgrey', ...args) - }, - ccerror (...args) { - const pageName = this.thisPage()?.route || 'VueApp' - console.error('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:red;background:lightgrey', ...args) - }, - ccdebug (...args) { - if (process.env.NODE_ENV !== 'production') { - const pageName = this.thisPage()?.route || 'VueApp' - console.debug('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:cyan;background:lightgrey', ...args) - } - }, - cctitle (...args) { - const pageName = this.thisPage().route || 'VueApp' - console.debug('%c ' + JSON.stringify({ time: new Date().toJSON(), page: pageName }), 'color:cyan;background:lightgrey', ...args) - }, - localizeText (i18nText) { i18nText = i18nText?.__page__ ? this.i18nText // 如果挂载到具体页面的 computed { lote: wo.localizeText } 那么 this 就是当前页面,直接取用 this.i18nText 即可。 @@ -151,8 +123,8 @@ export default { return route } - const hostname = envar.servHostname || 'localhost' - const port = envar.servPort || '' + const hostname = envar.servHostname /*|| globalThis.window?.location?.hostname*/ || 'localhost' + const port = envar.servPort /*|| globalThis.window?.location?.port*/ || '' const protocol = hostname === 'localhost' ? 'http' : envar.servProtocol || (process.env.NODE_ENV === 'production' ? 'https' : 'http') return `${protocol}://${hostname}${port ? ':' : ''}${port}/${route.replace(/^\//, '')}`