Skip to content

Commit d17e05e

Browse files
committed
Synced updates these days (#48a3f59).
1 parent 7d91e99 commit d17e05e

22 files changed

+299
-132
lines changed

src/support-vuejs/index.md

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
11
# 支持 Vue.js 的开发
22

3-
Vue.js 是采用 MIT 许可的开源项目,使用完全免费。但是随着项目规模的增长,也需要有相应的资金支持才能持续项目的维护的开发。你可以通过 [Patreon](https://www.patreon.com/evanyou) (每月,分级) 或 [PayPal](https://www.paypal.me/evanyou) (单次) 来赞助 Vue.js 的开发。
3+
Vue.js 是采用 MIT 许可的开源项目,使用完全免费。
4+
但是随着项目规模的增长,也需要有相应的资金支持才能持续项目的维护的开发。你可以通过下列的方法来赞助 Vue.js 的开发。
45

5-
### 全球白金赞助商 (2000 美元/月)
6+
- [通过 Patreon 赞助](https://www.patreon.com/evanyou) (直接支持 Evan You 的全职为 Vue 工作)
7+
8+
- [通过 OpenCollective 赞助](https://opencollective.com/vuejs) (加入一个基金会,通过透明的费用模型支持社区的工作和活动)
9+
10+
- [通过 PayPal 一次性捐助](https://www.paypal.me/evanyou)
11+
12+
## 当前的顶级赞助商
13+
14+
### Patreon 全球白金赞助商 (2000 美元/月)
615

716
<p style="text-align: center;">
817
<a href="https://stdlib.com">
918
<img style="width:300px" src="/images/stdlib.png">
1019
</a>
1120
</p>
1221

13-
### 中国区白金赞助商(1000 美元/月)
22+
### OpenCollective 白金赞助商 (2000 美元/月)
23+
24+
<p class="open-collective-sponsors sponsor-section">
25+
<a href="https://opencollective.com/vuejs/platinumsponsor/0/website" target="_blank"><img src="https://opencollective.com/vuejs/platinumsponsor/0/avatar.svg"></a><a href="https://opencollective.com/vuejs/platinumsponsor/1/website" target="_blank"><img src="https://opencollective.com/vuejs/platinumsponsor/1/avatar.svg"></a><a href="https://opencollective.com/vuejs/platinumsponsor/2/website" target="_blank"><img src="https://opencollective.com/vuejs/platinumsponsor/2/avatar.svg"></a><a href="https://opencollective.com/vuejs/platinumsponsor/3/website" target="_blank"><img src="https://opencollective.com/vuejs/platinumsponsor/3/avatar.svg"></a><a href="https://opencollective.com/vuejs/platinumsponsor/4/website" target="_blank"><img src="https://opencollective.com/vuejs/platinumsponsor/4/avatar.svg"></a><a href="https://opencollective.com/vuejs/platinumsponsor/5/website" target="_blank"><img src="https://opencollective.com/vuejs/platinumsponsor/5/avatar.svg"></a>
26+
</p>
27+
28+
### 中国区白金赞助商 (1000 美元/月)
1429

1530
<p style="text-align: center;">
1631
<a href="https://www.upyun.com/?utm_source=vue&utm_medium=ad&utm_content=index" target="_blank">
1732
<img src="/images/upyun-large.png" style="width:300px">
1833
</a>
1934
</p>
2035

21-
### 黄金赞助商 (500 美元/月)
36+
### Patreon 黄金赞助商 (500 美元/月)
2237

23-
<p style="text-align: center; margin-top: 0; margin-bottom: 60px" class="sponsors-page">
38+
<p class="patreon-sponsors sponsor-section">
2439
<a href="https://deepstreamhub.com" target="_blank" style="width:140px;top:1px">
2540
<img src="/images/deepstream.png" style="width:140px">
2641
</a><a href="https://jsfiddle.net">
@@ -41,15 +56,19 @@ Vue.js 是采用 MIT 许可的开源项目,使用完全免费。但是随着
4156
<img src="/images/vuejobs.svg">
4257
</a><a href="https://leanpub.com/vuejs2" target="_blank">
4358
<img src="/images/tmvuejs2.png">
44-
</a><a href="https://famebroker.com" target="_blank" style="width:135px">
45-
<img src="/images/famebroker.png" style="width:135px">
4659
</a><a href="https://component.io" target="_blank" style="width:140px">
4760
<img src="/images/component_io.png" style="width:140px">
4861
</a><a href="https://www.v2ex.com/t/379389" target="_blank" style="width:120px;">
4962
<img src="/images/v2exer.png" style="width:120px;">
5063
</a>
5164
</p>
5265

66+
### OpenCollective 黄金赞助商 (500 美元/月)
67+
68+
<p class="open-collective-sponsors sponsor-section">
69+
<a href="https://opencollective.com/vuejs/goldsponsor/0/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/0/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/1/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/1/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/2/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/2/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/3/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/3/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/4/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/4/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/5/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/5/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/6/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/6/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/7/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/7/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/8/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/8/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/9/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/9/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/10/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/10/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/11/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/11/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/12/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/12/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/13/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/13/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/14/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/14/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/15/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/15/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/16/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/16/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/17/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/17/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/18/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/18/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/19/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/19/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/20/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/20/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/21/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/21/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/22/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/22/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/23/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/23/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/24/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/24/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/25/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/25/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/26/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/26/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/27/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/27/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/28/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/28/avatar.svg"></a><a href="https://opencollective.com/vuejs/goldsponsor/29/website" target="_blank"><img src="https://opencollective.com/vuejs/goldsponsor/29/avatar.svg"></a>
70+
</p>
71+
5372
如果你是企业经营者并且将 Vue 用在商业产品中,那么赞助 Vue 有商业上的益处:**可以让你的产品所依赖的框架保持健康并得到积极的维护**,也能帮助你在 Vue 社区里获得更高的曝光度,从而更容易地吸引到 Vue 开发者。
5473

5574
如果你是个人开发者并且享受 Vue 带来的高开发效率,可以用捐助来表示你的谢意 —— 就好像偶尔给我买杯咖啡 :)

src/v2/api/index.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -389,17 +389,17 @@ type: api
389389

390390
- **用法**
391391

392-
```js
393-
var version = Number(Vue.version.split('.')[0])
394-
395-
if (version === 2) {
396-
// Vue v2.x.x
397-
} else if (version === 1) {
398-
// Vue v1.x.x
399-
} else {
400-
// Unsupported versions of Vue
401-
}
402-
```
392+
```js
393+
var version = Number(Vue.version.split('.')[0])
394+
395+
if (version === 2) {
396+
// Vue v2.x.x
397+
} else if (version === 1) {
398+
// Vue v1.x.x
399+
} else {
400+
// Unsupported versions of Vue
401+
}
402+
```
403403

404404
## 选项 / 数据
405405

@@ -1826,7 +1826,7 @@ if (version === 2) {
18261826
- **参数**:`attrOrProp (optional)`
18271827
18281828
- **修饰符**:
1829-
- `.prop` - 被用于绑定 DOM 属性。([what's the difference?](http://stackoverflow.com/questions/6003819/properties-and-attributes-in-html#answer-6004028))
1829+
- `.prop` - 被用于绑定 DOM 属性 (property)。([差别在那里?](https://stackoverflow.com/questions/6003819/properties-and-attributes-in-html#answer-6004028))
18301830
- `.camel` - (2.1.0+) 将 kebab-case 特性名转换为 camelCase. (从 2.1.0 开始支持)
18311831
- `.sync` (2.3.0+) 语法糖,会扩展成一个更新父组件绑定值的 `v-on` 侦听器。
18321832

src/v2/examples/hackernews.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ type: examples
44
order: 12
55
---
66

7-
> HackerNews 克隆是基于 HN 的官方 firebase API 、Vue 2.0 、vue-router 和 vuex 来构建的,使用服务器端渲染。
7+
> HackerNews 克隆是基于 HN 的官方 firebase API 、Vue 2.0 、Vue Router 和 Vuex 来构建的,使用服务器端渲染。
88
99
{% raw %}
1010
<div style="max-width:600px">
@@ -22,7 +22,7 @@ order: 12
2222
## 特性
2323

2424
- 服务器端渲染
25-
- Vue + vue-router + vuex
25+
- Vue + Vue Router + Vuex
2626
- 服务端数据提前获取
2727
- 客户端状态 & DOM 合并
2828
- 单文件 Vue 组件

src/v2/guide/comparison.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@ JSX 说是手写的渲染函数有下面这些优势:
6868

6969
更抽象一点来看,我们可以把组件区分为两类:一类是偏视图表现的 (presentational),一类则是偏逻辑的 (logical)。我们推荐在前者中使用模板,在后者中使用 JSX 或渲染函数。这两类组件的比例会根据应用类型的不同有所变化,但整体来说我们发现表现类的组件远远多于逻辑类组件。
7070

71-
#### CSS 的组件作用域
71+
#### 组件作用域内的 CSS
7272

73-
除非你把组件分布在多个文件上 (例如 [CSS Modules](https://github.com/gajus/react-css-modules)),要不在 React 中作用域内的 CSS 就会产生警告。非常简单的 CSS 还可以工作,但是稍微复杂点的,比如悬停状态、媒体查询、伪类选择符等要么通过沉重的依赖来重做要么就直接不能用
73+
除非你把组件分布在多个文件上 (例如 [CSS Modules](https://github.com/gajus/react-css-modules)),CSS 作用域在 React 中是通过 CSS-in-JS 的方案实现的 (比如 [styled-components](https://github.com/styled-components/styled-components)[glamorous](https://github.com/paypal/glamorous)[emotion](https://github.com/emotion-js/emotion))。这引入了一个新的面向组件的样式范例,它和普通的 CSS 撰写过程是有区别的。另外,虽然在构建时将 CSS 提取到一个单独的样式表是支持的,但 bundle 里通常还是需要一个运行时程序来让这些样式生效。当你能够利用 JavaScript 灵活处理样式的同时,也需要权衡 bundle 的尺寸和运行时的开销
7474

75-
而 Vue 可以让你在每个[单文件组件](single-file-components.html)中完全访问 CSS。
75+
如果你是一个 CSS-in-JS 的爱好者,许多主流的 CSS-in-JS 库也都支持 Vue (比如 [styled-components-vue](https://github.com/styled-components/vue-styled-components)[vue-emotion](https://github.com/egoist/vue-emotion))。这里 React 和 Vue 主要的区别是,Vue 设置样式的默认方法是[单文件组件](single-file-components.html)里类似 `style` 的标签。
76+
77+
[单文件组件](single-file-components.html)让你可以在同一个文件里完全控制 CSS,将其作为组件代码的一部分。
7678

7779
``` html
7880
<style scoped>
@@ -86,9 +88,7 @@ JSX 说是手写的渲染函数有下面这些优势:
8688

8789
这个可选 `scoped` 属性会自动添加一个唯一的属性 (比如 `data-v-21e5b78`) 为组件内 CSS 指定作用域,编译的时候 `.list-container:hover` 会被编译成类似 `.list-container[data-v-21e5b78]:hover`
8890

89-
如果你已经熟悉 CSS Modules,Vue 单文件组件也有 [first-class 支持它](https://vue-loader.vuejs.org/zh-cn/features/css-modules.html)
90-
91-
最后,就像 HTML 一样,你可以选择自己偏爱的 CSS 预处理器 (或后处理器) 编写 CSS,这些生态系统允许您利用现有的库。这可以让你围绕设计为中心展开工作,比如您的构建过程中颜色操作,而不是引入专门的库来增加你应用的体积和复杂度。
91+
最后,Vue 的单文件组件里的样式设置是非常灵活的。通过 [vue-loader](https://github.com/vuejs/vue-loader),你可以使用任意预处理器、后处理器,甚至深度集成 [CSS Modules](https://vue-loader.vuejs.org/en/features/css-modules.html)——全部都在 `<style>` 标签内。
9292

9393
### 规模
9494

@@ -177,7 +177,7 @@ Angular 事实上必须用 TypeScript 来开发,因为它的文档和学习资
177177

178178
在性能方面,这两个框架都非常的快,我们也没有足够的实际应用数据来下一个结论。如果你一定想看些数据的话,你可以参考这个[第三方跑分](http://stefankrause.net/js-frameworks-benchmark4/webdriver-ts/table.html)。单就这个跑分来看,Vue 似乎比 Angular 要更快一些。
179179

180-
在大小方面,最近的 Angular 版本中在使用了 AOT 和 tree-shaking 技术后使得最终的代码体积减小了许多。但即使如此,一个包含了 vuex + vue-router 的 Vue 项目 (30kb gzipped) 相比使用了这些优化的 `angular-cli` 生成的默认项目尺寸 (~130kb) 还是要小的多。
180+
在大小方面,最近的 Angular 版本中在使用了 AOT 和 tree-shaking 技术后使得最终的代码体积减小了许多。但即使如此,一个包含了 Vuex + Vue Router 的 Vue 项目 (30kb gzipped) 相比使用了这些优化的 `angular-cli` 生成的默认项目尺寸 (~130kb) 还是要小的多。
181181

182182
### 灵活性
183183

src/v2/guide/components.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,30 @@ new Vue({
326326
</script>
327327
{% endraw %}
328328

329+
如果你想要用一个对象作为 props 传递所有的属性,你可以使用不带任何参数的 `v-bind` (即用 `v-bind` 替换掉 `v-bind:prop-name`)。例如,已知一个 `todo` 对象:
330+
331+
``` js
332+
todo: {
333+
text: 'Learn Vue',
334+
isComplete: false
335+
}
336+
```
337+
338+
然后:
339+
340+
``` html
341+
<todo-item v-bind="todo"></todo-item>
342+
```
343+
344+
将等价于:
345+
346+
``` html
347+
<todo-item
348+
v-bind:text="todo.text"
349+
v-bind:is-complete="todo.isComplete"
350+
></todo-item>
351+
```
352+
329353
### 字面量语法 vs 动态语法
330354

331355
初学者常犯的一个错误是使用字面量语法传递数值:

src/v2/guide/deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ order: 401
1818

1919
#### Webpack
2020

21-
使用 Webpack 的 [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin) 来指定生产环境,以便在压缩时可以让 UglifyJS 自动删除代码块内的警告语句。例如配置:
21+
使用 Webpack 的 [DefinePlugin](https://webpack.github.io/docs/list-of-plugins.html#defineplugin) 来指定生产环境,以便在压缩时可以让 UglifyJS 自动删除代码块内的警告语句。例如配置:
2222

2323
``` js
2424
var webpack = require('webpack')

src/v2/guide/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ order: 2
66

77
## Vue.js 是什么
88

9-
Vue.js (读音 /vjuː/,类似于 **view**) 是一套构建用户界面的**渐进式框架**。与其他重量级框架不同的是,Vue 采用自底向上增量开发的设计。Vue 的核心库只关注视图层,它不仅易于上手,还便于与第三方库或既有项目整合。另一方面,当与[单文件组件](single-file-components.html)[Vue 生态系统支持的库](//github.com/vuejs/awesome-vue#libraries--plugins)结合使用时,Vue 也完全能够为复杂的单页应用程序提供驱动。
9+
Vue.js (读音 /vjuː/,类似于 **view**) 是一套构建用户界面的**渐进式框架**。与其他重量级框架不同的是,Vue 采用自底向上增量开发的设计。Vue 的核心库只关注视图层,它不仅易于上手,还便于与第三方库或既有项目整合。另一方面,当与[单文件组件](single-file-components.html)[Vue 生态系统支持的库](https://github.com/vuejs/awesome-vue#libraries--plugins)结合使用时,Vue 也完全能够为复杂的单页应用程序提供驱动。
1010

1111
如果你是有经验的前端开发者,想知道 Vue.js 与其它库/框架的区别,查看[对比其它框架](comparison.html)
1212

@@ -362,7 +362,7 @@ var app7 = new Vue({
362362

363363
### 与自定义元素的关系
364364

365-
你可能已经注意到 Vue 组件非常类似于**自定义元素**——它是 [Web 组件规范](//www.w3.org/wiki/WebComponents/)的一部分,这是因为 Vue 的组件语法部分参考了该规范。例如 Vue 组件实现了 [Slot API](//github.com/w3c/webcomponents/blob/gh-pages/proposals/Slots-Proposal.md)`is` 特性。但是,还是有几个关键差别:
365+
你可能已经注意到 Vue 组件非常类似于**自定义元素**——它是 [Web 组件规范](https://www.w3.org/wiki/WebComponents/)的一部分,这是因为 Vue 的组件语法部分参考了该规范。例如 Vue 组件实现了 [Slot API](https://github.com/w3c/webcomponents/blob/gh-pages/proposals/Slots-Proposal.md)`is` 特性。但是,还是有几个关键差别:
366366

367367
1. Web 组件规范仍然处于草案阶段,并且尚无浏览器原生实现。相比之下,Vue 组件不需要任何补丁,并且在所有支持的浏览器 (IE9 及更高版本) 之下表现一致。必要时,Vue 组件也可以包装于原生自定义元素之内。
368368

src/v2/guide/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ $ npm run dev
9090

9191
- **[CommonJS](http://wiki.commonjs.org/wiki/Modules/1.1)**:CommonJS 构建用来配合老的打包工具比如 [browserify](http://browserify.org/)[webpack 1](https://webpack.github.io)。这些打包工具的默认文件 (`pkg.main`) 是只包含运行时的 CommonJS 构建 (`vue.runtime.common.js`)。
9292

93-
- **[ES Module](http://exploringjs.com/es6/ch_modules.html)**:ES module 构建用来配合现代打包工具比如 [webpack 2](https://webpack.js.org)[rollup](http://rollupjs.org/)。这些打包工具的默认文件 (`pkg.module`) 是只包含运行时的 ES Module 构建 (`vue.runtime.esm.js`)。
93+
- **[ES Module](http://exploringjs.com/es6/ch_modules.html)**:ES module 构建用来配合现代打包工具比如 [webpack 2](https://webpack.js.org)[rollup](https://rollupjs.org/)。这些打包工具的默认文件 (`pkg.module`) 是只包含运行时的 ES Module 构建 (`vue.runtime.esm.js`)。
9494

9595
### 运行时 + 编译器 vs. 只包含运行时
9696

0 commit comments

Comments
 (0)