Skip to content

Commit b241d7b

Browse files
betweenbrainJinjiang
authored andcommitted
Updates render function tip with note about h not always being required (#1774)
1 parent b7f401c commit b241d7b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/v2/guide/render-function.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ new Vue({
490490
}
491491
})
492492
```
493-
<p class="tip">将 `h` 作为 `createElement` 的别名是 Vue 生态系统中的一个通用惯例,实际上也是 JSX 所要求的,如果在作用域中 `h` 失去作用,在应用中会触发报错。</p>
493+
<p class="tip">将 `h` 作为 `createElement` 的别名是 Vue 生态系统中的一个通用惯例,实际上也是 JSX 所要求的。从 Vue 的 Babel 插件的 [3.4.0 版本](https://github.com/vuejs/babel-plugin-transform-vue-jsx#h-auto-injection)开始,我们会在以 ES2015 语法声明的含有 JSX 的任何方法和 getter 中 (不是函数或箭头函数中) 自动注入 `const h = this.$createElement`,这样你就可以去掉 `(h)` 参数了。对于更早版本的插件,如果 `h` 在当前作用域中不可用,应用会抛错。</p>
494494

495495
更多关于 JSX 映射到 JavaScript,阅读 [使用文档](https://github.com/vuejs/jsx#installation)
496496

0 commit comments

Comments
 (0)