删除 ccxxx 的console输出函数,迁移到独立的 wo-core-coco 里

This commit is contained in:
陆柯 2023-01-19 18:09:13 +08:00
parent be2e61b516
commit 7995861193

View File

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