diff --git a/index.js b/index.js index e42320e..7b85f5e 100644 --- a/index.js +++ b/index.js @@ -47,6 +47,12 @@ export default { console.error('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:red', ...args) } }, + ccdebug(...args) { + if (process.env.NODE_ENV === 'development') { + const pageName = this.thisPage()?.route || 'App' + console.debug('%c '+JSON.stringify({time:new Date().toJSON(), page:pageName}), 'color:cyan', ...args) + } + }, localizeText(i18nText) { const pageNow = this?.$store ? this // 对于组件内定义的 i18nText,要使用 this 来获得组建内的 i18nText,而不是 getCurrentPages[...] 去访问全局页面的 i18nText。 @@ -482,14 +488,6 @@ export default { return format }, - hash(data, { hasher = 'sha256', salt, input = 'utf8', output = 'hex' } = {}) { - if (typeof data !== 'string' && !(data instanceof Buffer) && !(data instanceof DataView)) data = JSON.stringify(data) - if (salt && typeof salt === 'string') data = data + salt - let inputEncoding = input // my.INPUT_LIST.indexOf(option.input)>=0?option.input:my.INPUT // 'utf8', 'ascii' or 'latin1' for string data, default to utf8 if not specified; ignored for Buffer, TypedArray, or DataView. - let outputEncoding = output === 'buf' ? undefined : output // (my.OUTPUT_LIST.indexOf(output)>=0?output:my.OUTPUT) // option.output: 留空=》默认输出hex格式;或者手动指定 'buf', hex', 'latin1' or 'base64' - return require('crypto').createHash(hasher).update(data, inputEncoding).digest(outputEncoding) - }, - getUserEndLanIp(callback) { let recode = {}; let RTCPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;