我尝试使用React-share包将文章当前 URL 分享到 Facebook、Twitter 和 LinkedIn 等社交媒体。我在分享页面时遇到一些问题:
(网址: https: //www.linkedin.com/shareArticle/? url=https%3A%2F%2Fstaging.bidboxy.co%2Fcar-details%2Fhonda-brio-at-limited-edition&mini=true )
代码:
import React from 'react';
import { LinkedinShareButton } from "react-share";
let shareUrl = window.location.href;
export default class Share extends React.Component {
render() {
return(
<LinkedinShareButton url={`${shareUrl}`}>
<div className="icon-socmed-white linkedin">
<FaLinkedinIn/>
</div>
</LinkedinShareButton>)
}
}
Run Code Online (Sandbox Code Playgroud)
这种情况很奇怪,如果我尝试将主页页面作为共享文章共享,它会正常工作。