js interception array
在实现需求的时候遇到一个需要展示时段为:12:30-14:30
For example: the interface returns fields in this form
, which requires JSON.parse() to convert to a normal array structure
const time = JSON.parse(item.frameTime)
Then, use slice() of js to intercept
const _frameTime = time.map((item) => {
return item.slice(0, 5)
})
Finally, use join('-') to replace the "," in the array
const frameTime = _frameTime.join('-')