[英]How do I go to an external link when I click on a button in next js
<button type="button" className = {styles.googleButton}>
<img className = {styles.image} src = "assets/pictures/google.jpg"></img>
<p className = {styles.buttonText}> Go To Google</p>
<img src = "assets\icons\external-link.svg"></img>
</button>
當我單擊此按鈕時,如何在不同的選項卡上將 go 轉換為 google.com?
將它放在帶有空白標簽的 href 中,例如
<a href="https://www.google.com" target="_blank">
<img src = "assets\icons\external-link.svg"></img>
</a>
添加一個“a”標簽並將其目標值設置為“_blank”。 同時添加“rel='noreferrer'”。
這是一個例子。 它在我的 Nextjs 項目中為我工作:
<a href='https://www.google.com' target='_blank' rel='noreferrer'>
<button type='button'>
<img src='assets/pictures/google.jpg'></img>
<p> Go To Google</p>
<img></img>
</button>
</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.