相关疑难解决方法(0)

如何在 NextJS 的新标签页中打开链接?

如何在 NextJS 的新标签页中打开链接?我试过这个:

      <Link href="https://twitter.com/" passHref>
        <a target="_blank">
          <div className={`${dark ? styles.iconTwitterWhite : styles.iconTwitter} mr-3`} />
        </a>
      </Link>
Run Code Online (Sandbox Code Playgroud)

它在新标签中打开链接,但我有一条ESLint消息说:

ESLint: The href attribute is required for an anchor to be keyboard accessible. Provide a valid, navigable address as the href value. If you cannot provide an href, but still need the element to resemble a link, use a button and change it with appropriate styles.
Run Code Online (Sandbox Code Playgroud)

还有另一种方法吗?

next.js

12
推荐指数
8
解决办法
1万
查看次数

标签 统计

next.js ×1