gpt4 book ai didi

javascript - 在时刻时间戳之前添加字符串

转载 作者:行者123 更新时间:2023-12-01 00:16:45 24 4
gpt4 key购买 nike

clicked状态为true时,我使用React和Material UI来显示正在运行检查...。否则,我将使用 react-moment 显示时间戳。

 <Typography gutterBottom variant="caption">
{this.state.clicked
? "Running check..."
: <Moment local format={dateFormat}>{lastCheckedDateTime}</Moment> }
</Typography>

如何使用 Last check: 这样的字符串作为时间戳前缀?

最佳答案

不知道 Moment 组件渲染什么,但在它之前添加一个跨度或其他内容。如果 moment 组件是 block 元素,可能需要尝试一下样式:

 <Typography gutterBottom variant="caption">
{this.state.clicked
? "Running check..."
: (
<>
<span>Last checked: </span>
<Moment local format={dateFormat}>{lastCheckedDateTime}</Moment>
</>
)
}
</Typography>

关于javascript - 在时刻时间戳之前添加字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59708763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com