运行时配置
Nuxt Kit 提供了一组实用程序,可帮助你访问和修改 Nuxt 运行时配置。
useRuntimeConfig
在构建时,可以访问已解析的 Nuxt 运行时配置。
¥At build-time, it is possible to access the resolved Nuxt runtime config.
类型
¥Type
function useRuntimeConfig (): Record<string, unknown>
updateRuntimeConfig
也可以更新运行时配置。这将与现有的运行时配置合并,如果 Nitro 已经初始化,它将触发 HMR 事件以重新加载 Nitro 运行时配置。
¥It is also possible to update runtime configuration. This will be merged with the existing runtime configuration, and if Nitro has already been initialized it will trigger an HMR event to reload the Nitro runtime config.
function updateRuntimeConfig (config: Record<string, unknown>): void | Promise<void>