beforeCreate Before Instance Init
Last updated: 2026-10-22
beforeCreate Before Instance Init
beforeCreate runs before the instance is initialised — data, methods and computed do not exist yet, which is why it is rarely used.
| Group | Options: Rendering & Lifecycle |
|---|---|
| Kind | Option |
| Scope | Component |
| Vue Version | 3.0+ |
| SSR Support | Yes |
📝 Syntax
export default {
beforeCreate() {
// nothing like this.data exists yet
}
}
⚙️ Arguments
| value | No arguments; this refers to the not-yet-initialised instance |
|---|
Returns:No return value
▶ Example
Edit the code below and see the live result:
Output:
The console logs first, and the page shows the value set in created.
💡 Key Points
ℹ️ Note Plugins occasionally use it for pre-data initialisation.
⚠️ Warning Accessing this.xxx yields undefined — keep business logic out.
🏷️ Related Rendering & Lifecycle
💡 Related Cases
More case studies coming soon.
📚 Related Tutorials
❓ FAQ
Q What is it for?
A Rare plugin or mixin scenarios; created or setup usually suffices.
Q Can it fetch data?
A Technically, but there is no reactive state to write — use created.
Q Order relative to setup?
A setup runs between them and replaces most of their usage.