Skip to content

Commit aa76cd1

Browse files
authored
update lifecycle diagram and optimize it (#767)
1 parent 6da1feb commit aa76cd1

File tree

3 files changed

+154
-3
lines changed

3 files changed

+154
-3
lines changed
-399 KB
Binary file not shown.
Lines changed: 147 additions & 0 deletions
Loading

src/guide/instance.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
Every Vue application starts by creating a new **application instance** with the `createApp` function:
66

77
```js
8-
const app = Vue.createApp({ /* options */ })
8+
const app = Vue.createApp({
9+
/* options */
10+
})
911
```
1012

1113
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:
@@ -35,7 +37,9 @@ The options passed to `createApp` are used to configure the **root component**.
3537
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`:
3638

3739
```js
38-
const RootComponent = { /* options */ }
40+
const RootComponent = {
41+
/* options */
42+
}
3943
const app = Vue.createApp(RootComponent)
4044
const vm = app.mount('#app')
4145
```
@@ -109,4 +113,4 @@ Don't use [arrow functions](https://developer.mozilla.org/en/docs/Web/JavaScript
109113

110114
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.
111115

112-
<img src="/images/lifecycle.png" width="840" height="auto" style="margin: 0px auto; display: block; max-width: 100%;" loading="lazy" alt="Instance lifecycle hooks">
116+
<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 commit comments

Comments
 (0)