Node.js/nuxt/生命周期:修订间差异
来自康健生活
| 第33行: | 第33行: | ||
} | } | ||
} | } | ||
}</syntaxhighlight> | |||
== 常见对象 == | |||
<syntaxhighlight lang="javascript"> | |||
export default { | |||
asyncData() { | |||
console.log(window) // 服务端报错 | |||
}, | |||
fetch() { | |||
console.log(window) // 服务端报错 | |||
}, | |||
created () { | |||
console.log(window) // undefined | |||
}, | |||
mounted () { | |||
console.log(window) // Window {postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, frames: Window, …} | |||
} | |||
}</syntaxhighlight> | }</syntaxhighlight> | ||