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

update render-function-api.md #738

Merged
merged 1 commit into from
Sep 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/guide/migration/render-function-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default {

### 2.x 语法

在 2.x 中,注册一个组件后,把组件名作为字符串传给渲染函数的第一个参数,渲染函数可以正常的工作
在 2.x 中,注册一个组件后,把组件名作为字符串传递给渲染函数的第一个参数,它可以正常地工作

```js
// 2.x
Expand All @@ -159,7 +159,7 @@ export default {

### 3.x 语法

在 3.x 中,由于 VNode 是上下文无关的,不能再用字符串 ID 隐式查找已注册组件。相反地,需要使用一个导入的 `resolveComponent` 方法:
在 3.x 中,由于 VNode 是上下文无关的,不能再用字符串 ID 隐式查找已注册组件。取而代之的是,需要使用一个导入的 `resolveComponent` 方法:

```js
// 3.x
Expand All @@ -184,9 +184,9 @@ export default {

全局导入 `h` 意味着任何包含 Vue 组件的库都将在某处包含 `import { h } from 'vue'`。这会带来一些开销,因为它需要库作者在其构建设置中正确配置 Vue 的外部化:

- Vue 不应绑定到库中
- 对于模块构建,导入应该保持独立,由最终用户的打包器处理
- 对于 UMD / browser 构建版本,应该首先尝试全局 Vue.h,不存在时再使用 require 调用
- Vue 不应打包到库中
- 对于模块构建版本,导入应该保持独立,并由终端用户的打包器处理
- 对于 UMD / 浏览器构建版本,应该首先尝试全局 Vue.h,不存在时再使用 require 调用

## 下一步

Expand Down