Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.

Commit fc35fe3

Browse files
authored
Merge pull request #160 from watonyweng/master
docs: application-api.md
2 parents 73f0641 + 9ecc4b5 commit fc35fe3

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/api/application-api.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 应用 API
22

3-
在 Vue 3 中,全局改变 Vue 行为的 API 现在移动到了由新的 `createApp` 方法所创建的应用实例上。此外,现在它们的影响仅限于该特定应用实例:
3+
在 Vue 3 中,改变全局 Vue 行为的 API 现在被移动到了由新的 `createApp` 方法所创建的应用实例上。此外,现在它们的影响仅限于该特定应用实例:
44

55
```js
66
import { createApp } from 'vue'
@@ -19,7 +19,7 @@ const app = createApp({})
1919
- `{string} name`
2020
- `{Function | Object} [definition]`
2121

22-
- **返回**
22+
- **返回值**
2323

2424
- 如果传入 `definition` 参数,返回应用实例。
2525
- 如果不传入 `definition` 参数,返回组件定义。
@@ -35,7 +35,7 @@ import { createApp } from 'vue'
3535

3636
const app = createApp({})
3737

38-
// 注册一个选项对象
38+
// 注册一个名为my-component的组件
3939
app.component('my-component', {
4040
/* ... */
4141
})
@@ -70,7 +70,7 @@ app.config = {...}
7070
- `{string} name`
7171
- `{Function | Object} [definition]`
7272

73-
- **返回**
73+
- **返回值**
7474

7575
- 如果传入 `definition` 参数,返回应用实例。
7676
- 如果不传入 `definition` 参数,返回指令定义。
@@ -87,7 +87,7 @@ const app = createApp({})
8787

8888
// 注册
8989
app.directive('my-directive', {
90-
// 指令具有一组生命周期钩子
90+
// 指令是具有一组生命周期的钩子
9191
// 在绑定元素的父组件挂载之前调用
9292
beforeMount() {},
9393
// 绑定元素的父组件挂载时调用
@@ -150,12 +150,12 @@ app.directive('focus', {
150150

151151
上面作为 el 参数收到的真实 DOM 元素的蓝图。
152152

153-
#### prevNode
153+
#### prevNode
154154

155155
上一个虚拟节点,仅在 `beforeUpdate``updated` 钩子中可用。
156156

157157
:::tip Note
158-
除了 `el` 之外,你应该将这些参数视为只读,并且永远不要修改它们。如果你需要跨钩子共享信息,建议通过元素的[自定义数据属性集](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset)进行共享。
158+
除了 `el` 之外,你应该将这些参数视为只读,并且永远不要修改它们。如果你需要跨钩子共享信息,建议通过元素的[自定义数据属性集](https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLElement/dataset)进行共享。
159159
:::
160160

161161
- **参考:**[自定义指令](../guide/custom-directive.html)
@@ -166,7 +166,7 @@ app.directive('focus', {
166166

167167
- `{Object} mixin`
168168

169-
- **返回**
169+
- **返回值**
170170

171171
- 应用实例
172172

@@ -183,7 +183,7 @@ app.directive('focus', {
183183
- `{Element | string} rootContainer`
184184
- `{boolean} isHydrate`
185185

186-
- **返回**
186+
- **返回值**
187187

188188
- 根组件实例
189189

@@ -217,7 +217,7 @@ app.mount('#my-app')
217217
- `{string | Symbol} key`
218218
- `value`
219219

220-
- **返回**
220+
- **返回值**
221221

222222
- 应用实例
223223

@@ -293,7 +293,7 @@ setTimeout(() => app.unmount('#my-app'), 5000)
293293
- `{Object | Function} plugin`
294294
- `...options (可选)`
295295

296-
- **返回**
296+
- **返回值**
297297

298298
- 应用实例
299299

0 commit comments

Comments
 (0)