阅读(4664) (9)

Nuxt Class

2020-02-13 17:50:45 更新

Nuxt Class

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

Hooks

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

nuxt.hook('ready', async (nuxt) => {
  // Your custom code here
})
PluginArgumentsWhen
ready(nuxt)Nuxt实例初始化 (ModuleContainer 和 Renderer 已经准备好).
error(error)调用hooks时出现未处理的错误。
close(nuxt)Nuxt实例优雅地关闭。
listen(server, {host, port})Nuxt内部服务器开始监听。 (使用 nuxt start 或 nuxt dev).