Skip to content

Commit

Permalink
update lifecycle diagram and optimize it (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdras committed Dec 27, 2020
1 parent 6da1feb commit aa76cd1
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 3 deletions.
Binary file removed src/.vuepress/public/images/lifecycle.png
Binary file not shown.
147 changes: 147 additions & 0 deletions src/.vuepress/public/images/lifecycle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src/guide/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
Every Vue application starts by creating a new **application instance** with the `createApp` function:

```js
const app = Vue.createApp({ /* options */ })
const app = Vue.createApp({
/* options */
})
```

The application instance is used to register 'globals' that can then be used by components within that application. We'll discuss that in detail later in the guide but as a quick example:
Expand Down Expand Up @@ -35,7 +37,9 @@ The options passed to `createApp` are used to configure the **root component**.
An application needs to be mounted into a DOM element. For example, if we want to mount a Vue application into `<div id="app"></div>`, we should pass `#app`:

```js
const RootComponent = { /* options */ }
const RootComponent = {
/* options */
}
const app = Vue.createApp(RootComponent)
const vm = app.mount('#app')
```
Expand Down Expand Up @@ -109,4 +113,4 @@ Don't use [arrow functions](https://developer.mozilla.org/en/docs/Web/JavaScript

Below is a diagram for the instance lifecycle. You don't need to fully understand everything going on right now, but as you learn and build more, it will be a useful reference.

<img src="/images/lifecycle.png" width="840" height="auto" style="margin: 0px auto; display: block; max-width: 100%;" loading="lazy" alt="Instance lifecycle hooks">
<img src="/images/lifecycle.svg" width="840" height="auto" style="margin: 0px auto; display: block; max-width: 100%;" loading="lazy" alt="Instance lifecycle hooks">

0 comments on commit aa76cd1

Please sign in to comment.