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(/^\//, '')}`