LobeChatLobeHub
UI
Components
Chat
Mobile
Awesome
Brand
Mdx
Color
Changelog
Ctrl K
Data Display
ChatItem
ChatList
TokenTag
Data Entry
ChatInputArea
EditableMessage
EditableMessageList
MessageInput
Feedback
MessageModal
Layout
ChatHeader
Navigation
BackBottom

ChatList

ChatList is a component used to display a list of chat messages. It takes in an array of ChatMessage objects as the data prop and an optional type prop which can be either 'docs' or 'chat'. The component is memoized for better performance.

import { ChatList } from '@lobehub/ui/chat';
NPM
UNPKG
BundlePhobia
PackagePhobia
Anvaka Graph
Source
Edit
Previous
ChatItem
Next
TokenTag

Resources

Lobe UI-AIGC Components
Lobe Icon-AI / LLM Icon Collection
Lobe Charts-Modern Charts
Lobe TTS-TTS / STT Library

Community

Report Bug
Request Feature

Help

GitHub
Changelog

More Products

🤯 Lobe Chat-AI / LLM Chat Framework
🧸 Lobe Vidol-Virtual Idols for EveryOne
🅰️ Lobe Theme-Stable Diffusion Extension
🌐 Lobe i18n-AI i18next CLI
Copyright © 2022-2025
Made with 🤯 by LobeHub
LobeHub

Default

APIs

NameDescriptionTypeDefault
dataData of chat messages to be displayedChatMessage[](required)
enableHistoryCount--boolean--
historyCount--number--
loadingId--string--
groupNav--any--
loading--boolean--
onActionsClick点击操作按钮的回调函数(action:any,message:any)=>void--
onAvatarsClick--(role:any)=>any--
onMessageChange消息变化的回调函数(id:string,content:string)=>void--
renderActions--{}--
renderErrorMessages渲染错误消息的函数{}--
renderItems--{}--
renderMessages渲染消息的函数{}--
renderMessagesExtra渲染消息额外内容的函数{}--
showTitle是否显示聊天项的名称booleanfalse
text文本内容any--
type聊天列表的类型"docs"|"chat""chat"
CanisMinor
2023-06-10 22:59:10

dayjs 如何使用 fromNow

😎
2023-06-12 03:02:30

要使用 dayjs 的 fromNow 函数,需要先安装 dayjs 库并在代码中引入它。然后,可以使用以下语法来获取当前时间与给定时间之间的相对时间:

javascript
dayjs().fromNow(); // 获取当前时间的相对时间
dayjs('2021-05-01').fromNow(); // 获取给定时间的相对时间

第一个示例将返回类似于 "几秒前"、"一分钟前"、"2 天前" 的相对时间字符串,表示当前时间与调用 fromNow 方法时的时间差。第二个示例将返回给定时间与当前时间的相对时间字符串。