在渲染 island 组件时,island 组件的内容是静态的,因此客户端不会下载任何 JS。
更改 island 组件的 props 会触发对该 island 组件的重新获取以再次渲染它。
<NuxtIsland>。name : 要渲染的组件名称。
stringlazy: 将组件设为非阻塞。
booleanfalseprops: 传递给渲染组件的 props。
Record<string, any>source: 调用要渲染的 island 的远程来源。
stringbooleanfalsenuxt.config 中将 experimental.componentIslands 设置为 'local+remote'。
强烈不建议启用 dangerouslyLoadClientComponents,因为你不能信任远程服务器的 JavaScript。~/components/islands/ 目录中扫描。因此 ~/components/islands/MyIsland.vue 组件可以通过 <NuxtIsland name="MyIsland" /> 来渲染。如果声明了插槽(slot),则可以将插槽传递给 island 组件。
每个插槽都是交互式的,因为父组件是提供它的那一方。
有些插槽为 NuxtIsland 保留以处理特殊情况。
#fallback: 指定在 island 加载之前(如果组件为 lazy)或 NuxtIsland 无法获取组件时要渲染的内容。refresh()() => Promise<void>errorunknownNuxtIsland 无法获取新的 island 时触发。