Skip to content

[zh-cn] improved #1012 #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 25, 2017
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
15 changes: 15 additions & 0 deletions docs/zh-cn/features/functional.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 函数式组件的模板

> 新增于 13.1.0,需要 Vue 版本 >= 2.5.0
`vue-loader >= 13.3.0` 开始,在一个 `*.vue` 文件中以单文件形式定义的函数式组件,现在在模板编译、有作用域的 CSS 和热重载也有了良好的支持。

要声明一个应该编译为函数式组件的模板,请将 `functional` 特性添加到模板块中。这样做以后就可以省略 `<script>` 块中的 `functional` 选项。

模板中的表达式会在[函数式渲染上下文](https://cn.vuejs.org/v2/guide/render-function.html#函数式组件)中求值。这意味着在模板中,prop 需要以 `props.xxx` 的形式访问:

```html
<template functional>
<div>{{ props.foo }}</div>
</template>
```