react-router处理特殊字符#

遇到的问题
http://localhost:8088/user/current-conversation/GROUP@TGS#15S477ZGI
【GROUP@TGS#15S477ZGI】是群组会话ID,可是这个会话ID里面有#,#是url的特殊字符表示锚点,致使在详情页里面取到的会话ID没有#后面的部分this

解决方法:url

this.props.history.push(`/user/current-conversation/$
{encodeURIComponent(encodeURIComponent(conversation.conversationID))}
`);

两次encodeURIComponent
在详情页里面两次decodeURIComponentcode

相关文章
相关标签/搜索