文档中心Next.js跨域 使用 crossOrigin 选项可在所有由 App Router Onlynext/script 组件Pages Router Onlynext/script 和 next/head 组件生成的 <script> 标签中添加 crossOrigin 属性,并定义如何处理跨域请求。 Copyjavascriptmodule.exports = { crossOrigin: 'anonymous', } 选项 'anonymous': 添加 crossOrigin="anonymous" 属性。 'use-credentials': 添加 crossOrigin="use-credentials"。