Skip to content

Commit

Permalink
Merge pull request #470 from Vector-Hope/release-3.6.8-app
Browse files Browse the repository at this point in the history
fix: 修复控制台打印回调异常,format map代码格式
  • Loading branch information
tangcq-code authored Dec 7, 2023
2 parents 62b4136 + 701e12c commit 0e4fafb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 5 additions & 3 deletions examples/mini-program-example/src/pages/component/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ export default class PageView extends React.Component {

handleClickLatitude = async () => {
const latitude = /^-?\d+(\.\d+)?$/.test(this.state.lat.toString()) || this.state.lat === 0 ? this.state.lat : ''
await this.setState({
await this.setState(
{
latitude,
isShow: false,
},
Expand All @@ -192,8 +193,9 @@ export default class PageView extends React.Component {
}

handleClickLongitude = async () => {
const longitude = /^-?\d+(\.\d+)?$/.test(this.state.lng.toString()) || this.state.lng === 0 ? this.state.lng : ''
await this.setState({
const longitude = /^-?\d+(\.\d+)?$/.test(this.state.lng.toString()) || this.state.lng === 0 ? this.state.lng : ''
await this.setState(
{
longitude,
isShow: false,
},
Expand Down
12 changes: 5 additions & 7 deletions examples/mini-program-example/src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ function setCallbackRes(res, type, apiIndex) {
}

let startTime = NaN
let endTime = NaN

function getCostTime() {
return startTime ? Date.now() - startTime : -1
Expand All @@ -21,7 +20,6 @@ function getCostTime() {
export const TestConsole = {
consoleTest: (apiName: string) => {
startTime = Date.now()
endTime = NaN
console.log(
`\n%c------------------------------start test [${apiName}]------------------------------`,
'color:blue;font-weight:bold'
Expand All @@ -31,32 +29,32 @@ export const TestConsole = {
const costTime = getCostTime()
setCallbackRes.call(this, res, 'success', apiIndex)
setCallbackRes.call(this, costTime, 'costTime', apiIndex)
console.log('%csuccess:\n', 'color:green;font-weight:bold', { ...res, costTime })
console.log('%csuccess:\n', 'color:green;font-weight:bold', { success: res, costTime })
},
consoleFail: function (res, apiIndex = -1) {
const costTime = getCostTime()
setCallbackRes.call(this, res, 'fail', apiIndex)
setCallbackRes.call(this, costTime, 'costTime', apiIndex)
console.log('%cfail:\n', 'color:red;font-weight:bold', { ...res, costTime })
console.log('%cfail:\n', 'color:red;font-weight:bold', { fail: res, costTime })
},
consoleComplete: function (res, apiIndex = -1) {
const costTime = getCostTime()
setCallbackRes.call(this, res, 'complete', apiIndex)
setCallbackRes.call(this, costTime, 'costTime', apiIndex)
console.log('%ccomplete:\n', 'color:black;font-weight:bold', { ...res, costTime })
console.log('%ccomplete:\n', 'color:black;font-weight:bold', { complete: res, costTime })
},
consoleResult: function (res, apiIndex = -1) {
const costTime = getCostTime()
startTime = NaN
setCallbackRes.call(this, res, 'result', apiIndex)
setCallbackRes.call(this, costTime, 'costTime', apiIndex)
console.log('%cresult:\n', 'color:blue;font-weight:bold', { ...res, costTime })
console.log('%cresult:\n', 'color:blue;font-weight:bold', { result: res, costTime })
},
consoleOnCallback: function (res, apiName, apiIndex = -1) {
const costTime = getCostTime()
setCallbackRes.call(this, res, 'callback', apiIndex)
setCallbackRes.call(this, costTime, 'costTime', apiIndex)
console.log(`%c${apiName} callback:\n`, 'color:green;font-weight:bold', { ...res, costTime })
console.log(`%c${apiName} callback:\n`, 'color:green;font-weight:bold', { callback: res, costTime })
},
consoleNormal: (name: string, data?: any) => {
if (data) {
Expand Down

0 comments on commit 0e4fafb

Please sign in to comment.