-
Notifications
You must be signed in to change notification settings - Fork 916
新增functional.md的中文翻译 #1012
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
新增functional.md的中文翻译 #1012
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# 函数式组件的模板 | ||
|
||
> 新增于13.1.0, 需要Vue版本 >= 2.5.0 | ||
|
||
从`vue-loader >= 13.3.0`开始, 在一个`*.vue`文件中,以单文件组件定义的函数式组件,现在得到了对模板编译、Scoped CSS和热重载的良好支持。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scoped CSS -> 有作用域的 CSS There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. “在一个 |
||
|
||
要声明一个应该编译为函数式组件的模板,请将`functional`属性添加到 template 块中。这也允许在`<script>`块中省略`functional`选项。 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. “这样做以后就可以省略 |
||
|
||
模板中的表达式会在[函数式渲染上下文](https://cn.vuejs.org/v2/guide/render-function.html#函数式组件)中求值。这意味着在模板中,props需要以`props.xxx`的形式访问: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
这里的 props 在中文翻译中去掉复数格式,即 prop。 |
||
```html | ||
<template functional> | ||
<div>{{ props.foo }}</div> | ||
</template> | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里的缩进有些问题,请和原文保持一致 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
中文和英文/数字之间要有空格,标点符号用全角标点符号。如:
新增于 13.1.0,需要 Vue 版本 >= 2.5.0
。下同