我正在用 gatsby 写博客,但是,Link
不适用于 mailto
这是我的代码。它把我带到 http://localhost:8000/mailto:kjcoco13@gmail.com
我想用这个Link
为外部。
<Link to='mailto:kjcoco13@gmail.com'></Link>
最佳答案
Gatsby 的 <Link>
组件扩展自 @reach/router
(来自 React)并且它仅用于内部导航。来自 Gatsby's documentation :
The Gatsby
<Link />
component is for linking between pages within your site. For external links to pages not handled by your Gatsby site, use the regular HTML<a>
tag.
在您的情况下,由于您没有使用任何类型的内部导航,您应该使用常规
<a>
标签,您不能使用 <Link>
成分。用:<a href='mailto:kjcoco13@gmail.com'>Your text</a>
关于javascript - 如何为 'mailto' 建立 Gatsby 链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65529898/