Want to take a look at our new docs? Our new docs are now in beta. Have fun!

API: The Nuxt Class

Nuxt Class

这是核心容器,允许所有模块和类相互通信。所有模块都可以使用this.nuxt访问 Nuxt 实例。

Hooks

我们可以在某些生命周期事件中注册 hooks。

nuxt.hook('ready', async nuxt => {
  // Your custom code here
})
PluginArgumentsWhen
ready(nuxt)Nuxt 实例初始化 (ModuleContainerRenderer 已经准备好).
error(error)调用 hooks 时出现未处理的错误。
close(nuxt)Nuxt 实例优雅地关闭。
listen(server, {host, port})Nuxt内部服务器开始监听。 (使用 nuxt startnuxt dev).
Contribution for this page is now closed. If you would like to contribute please check out our new docs are now in beta. Have fun!

Platinum Sponsors

StoryblokMoovweb Support Us