Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

长文本是否可以折叠?👑 [需求] #158

Open
liguobao opened this issue Apr 9, 2024 · 4 comments
Open

长文本是否可以折叠?👑 [需求] #158

liguobao opened this issue Apr 9, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@liguobao
Copy link

liguobao commented Apr 9, 2024

截屏2024-04-09 11 51 21

文本太长了,想给个自动折叠的效果。

@ONLY-yours
Copy link
Collaborator

ChatItemRender -> ContentRender
然后包裹一个antd 的折叠框应该就好了

@ONLY-yours ONLY-yours added the documentation Improvements or additions to documentation label Apr 9, 2024
@liguobao
Copy link
Author

liguobao commented Apr 9, 2024

这个怎么控制呢?现在用哪个接口能实现类似的效果?

@ONLY-yours
Copy link
Collaborator

自动折叠感觉是个业务逻辑,我理解这个逻辑你可以在 render 里面去写,例如

const [open,setOpen] = useState(false)

useEffect(()=>{
  // 这里写你的什么时候展开/缩略的逻辑
    if(xxxx){
        setOpen(true)
    }
},[])

// Components
chatItemRenderConfig={{
          contentRender: (_, defaultContent) => {
            return (
              < Collapse
                open={open}
              >
                {defaultContent}
              </Collapse >
            );
          },
        }}

@liguobao
Copy link
Author

liguobao commented Apr 9, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants