简体   繁体   English

如何<a>在 Next.js 中启用标签的使用?</a>

[英]How to enable the use of <a> tag in Next.js?

I don't want to use <Link> from next.我不想从下一个使用<Link> I've been researching how to disable this, but I can't.我一直在研究如何禁用它,但我不能。

I want to disable this and use the default html tag <a> .我想禁用它并使用默认的 html 标签<a>

It doesn't let me deploy, it keeps giving error because of that.它不允许我部署,因此它不断给出错误。

Can anyone help me?谁能帮我?

The error I get:我得到的错误:

12:9 Error: Do not use the HTML tag to navigate to /. 12:9 错误:不要使用 HTML 标签导航到 /。 Use Link from 'next/link' instead.请改用“下一个/链接”中的链接。 See: https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages请参阅:https://nextjs.org/docs/messages/no-html-link-for-pages @next/next/no-html-link-for-pages

You can disable the @next/next/no-html-link-for-pages ESLint rule in your .eslintrc file.您可以在.eslintrc文件中禁用@next/next/no-html-link-for-pages ESLint 规则。

{
  // ...
  "rules": {
    // Other rules
    "@next/next/no-html-link-for-pages": "off"
  }
}

Note that the above is not recommended, as using <a> elements instead of the next/link component will disable client-side route transitions between pages.请注意,不建议使用上述方法,因为使用<a>元素而不是next/link组件将禁用页面之间的客户端路由转换。 This means all pages will be loaded from the server.这意味着所有页面都将从服务器加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM