Skip to content

Commit 03f7687

Browse files
committed
Merge branch 'master' into 2.0-cn
* master: Improve responsive design on mobile devices (vuejs#428) Fix typo in Server-Side Rendering guide (vuejs#434) Small refactor of count + knife > 1 knife (vuejs#433) Update unit-testing.md (vuejs#430) Fix a broken loader url (vuejs#429) make component examples clearer in guide index remove number for example in guide index 2.0.1 update cdn link fix npm main export instructions 2.0 fix example links update commits example url # Conflicts: # src/guide/index.md # src/guide/ssr.md # themes/vue/_config.yml
2 parents 42276bc + f6868ec commit 03f7687

21 files changed

+79
-77
lines changed

src/examples/commits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 1
66

77
> This example fetches latest Vue.js commits data from GitHub's API and displays them as a list. You can switch between the master and dev branches.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/cLvadprL/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/c5g8xnar/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/elastic-header.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ type: examples
44
order: 7
55
---
66

7-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/5hfsajjr/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
7+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/y91wy85p/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/firebase.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 2
66

77
> This example uses [Firebase](https://www.firebase.com/) as the data persistence backend and syncs between clients in real time (you can try opening it in multiple browser tabs). In addition, it performs instant validation using computed properties and triggers CSS transitions when adding/removing items.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/7vLv44kh/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/hkrxmp0h/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/grid-component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 3
66

77
> This is an example of creating a reusable grid component and using it with external data.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/23qze30k/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/xkkbfL3L/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 0
66

77
> Dead simple Markdown editor.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/v368d4g3/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/pq22eoj5/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/modal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 6
66

77
> Features used: component, prop passing, content insertion, transitions.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/70yyx8z2/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/mwLbw11k/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/select2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 8
66

77
> In this example we are integrating a 3rd party jQuery plugin (select2) by wrapping it inside a custom component.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/j17w6kjh/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/fruqrvdL/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/svg.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 5
66

77
> This example showcases a combination of custom component, computed property, two-way binding and SVG support.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/8rj70kh1/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/mhrckqgq/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/todomvc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 9
66

77
> This is a fully spec-compliant TodoMVC implementation in under 120 effective lines of JavaScript (excluding comments and blank lines).
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/aump8a25/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/4dr2fLb7/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/examples/tree-view.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ order: 4
66

77
> Example of a simple tree view implementation showcasing recursive usage of components.
88
9-
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/5oyu4c4u/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>
9+
<iframe width="100%" height="500" src="https://jsfiddle.net/yyx990803/3p0j5sgy/embedded/result,html,js,css" allowfullscreen="allowfullscreen" frameborder="0"></iframe>

src/guide/index.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ var app3 = new Vue({
122122

123123
在控制台设置 `app3.seen = false`,可以看到消息消失了。
124124

125-
126-
第二个示例演示了我们不仅可以绑定数据到文本和属性,也可以绑定到DOM结构上。甚至,Vue还提供一套强力的过渡系统在元素通过Vue插入/更新/移除自动应用[过渡效果](transitions.html)
125+
示例演示了我们不仅可以绑定数据到文本和属性,也可以绑定到DOM结构上。甚至,Vue还提供一套强力的过渡系统在元素通过Vue插入/更新/移除自动应用[过渡效果](transitions.html)
127126

128127
这里有一些其他指令,每一个都有自己独特的函数。例如,`v-for`指令可以被用来从数组数据中展示列表元素。
129128

@@ -263,7 +262,8 @@ var app6 = new Vue({
263262
Vue中,一个组件基本上是一个预定义了设置的Vue实例。在Vue注册组件也很简单:
264263

265264
``` js
266-
Vue.component('todo', {
265+
// Define a new component called todo-item
266+
Vue.component('todo-item', {
267267
template: '<li>This is a todo</li>'
268268
})
269269
```
@@ -272,14 +272,21 @@ Vue.component('todo', {
272272

273273
``` html
274274
<ul>
275-
<todo v-for="todo in todos"></todo>
275+
<!--
276+
Create an instance of the todo-item component
277+
for each todo in a todos array
278+
-->
279+
<todo-item v-for="todo in todos"></todo-item>
276280
</ul>
277281
```
278282

279283
不过每个Todo都渲染一样的文本并不有趣。我们可以从父组件传递数据到子组件中。让我们修改组件定义,使它可以结构一个 [prop](/guide/components.html#Props)
280284

281285
``` js
282-
Vue.component('todo', {
286+
Vue.component('todo-item', {
287+
// The todo-item component now accepts a
288+
// "prop", which is like a custom attribute.
289+
// This prop is called todo.
283290
props: ['todo'],
284291
template: '<li>{{ todo.text }}</li>'
285292
})
@@ -290,7 +297,11 @@ Vue.component('todo', {
290297
``` html
291298
<div id="app-7">
292299
<ol>
293-
<todo v-for="todo in todos" v-bind:todo="todo"></todo>
300+
<!--
301+
Now we provide each todo-item with the todo object
302+
it's representing, so that its content can be dynamic
303+
-->
304+
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
294305
</ol>
295306
</div>
296307
```
@@ -305,11 +316,11 @@ var app7 = new Vue({
305316
{% raw %}
306317
<div id="app-7" class="demo">
307318
<ol>
308-
<todo v-for="todo in todos" v-bind:todo="todo"></todo>
319+
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
309320
</ol>
310321
</div>
311322
<script>
312-
Vue.component('todo', {
323+
Vue.component('todo-item', {
313324
props: ['todo'],
314325
template: '<li>{{ todo.text }}</li>'
315326
})
@@ -326,7 +337,7 @@ var app7 = new Vue({
326337
</script>
327338
{% endraw %}
328339

329-
这只是一个例子,不过我们已经成功将应用分成两个更小的单元,并且子组件可以与父组件通过props很好地解耦。我们现在可以进一步使用复杂的模板和不影响父组件的逻辑改良`<todo>`组件
340+
这只是一个例子,不过我们已经成功将应用分成两个更小的单元,并且子组件可以与父组件通过props很好地解耦。我们现在可以进一步使用复杂的模板和不影响父组件的逻辑改良`<todo-item>`组件
330341

331342
在大型应用中,很有必要把整个应用拆分使开发更好管理。更多关于组件的内容在[后面的指南](/guide/components.html),这里有个类似的示例展示应用的模板可以像这样:
332343

src/guide/installation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: 安装
33
type: guide
44
order: 1
5-
vue_version: 2.0.0-rc.8
6-
dev_size: "183.80"
7-
min_size: "61.54"
8-
gz_size: "22.53"
5+
vue_version: 2.0.1
6+
dev_size: "184.49"
7+
min_size: "61.72"
8+
gz_size: "22.58"
99
---
1010

1111
### 兼容性
@@ -30,7 +30,7 @@ Vue.js 不支持 IE8 及其以下版本,因为 Vue.js 使用了 IE8 不能实
3030

3131
### CDN
3232

33-
Recommended: [unpkg](https://unpkg.com/vue), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [unpkg.com/vue/](https://unpkg.com/vue/).
33+
Recommended: [unpkg](https://unpkg.com/vue/dist/vue.js), which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at [unpkg.com/vue/](https://unpkg.com/vue/).
3434

3535
Also available on [jsdelivr](//cdn.jsdelivr.net/vue/{{vue_version}}/vue.js) or [cdnjs](//cdnjs.cloudflare.com/ajax/libs/vue/{{vue_version}}/vue.js), but these two services take some time to sync so the latest release may not be available yet.
3636

@@ -47,23 +47,23 @@ $ npm install vue
4747

4848
There are two builds available, the standalone build and the runtime-only build.
4949

50-
- The standalone build includes the compiler and supports the `template` option.
50+
- The standalone build includes the compiler and supports the `template` option. **It also relies on the presence of browser APIs so you cannot use it for server-side rendering.**
5151

5252
- The runtime-only build does not include the template compiler, and does not support the `template` option. You can only use the `render` option when using the runtime-only build, but it works with single-file components, because single-file components' templates are pre-compiled into `render` functions during the build step. The runtime-only build is roughly 30% lighter-weight than the standalone build, weighing only 16kb min+gzip.
5353

54-
By default, the NPM package exports the standalone build. To use the runtime-only build, add the following alias to your webpack config:
54+
By default, the NPM package exports the **runtime-only** build. To use the standalone build, add the following alias to your webpack config:
5555

5656
``` js
5757
resolve: {
5858
alias: {
59-
vue: 'vue/dist/vue.common.js'
59+
vue: 'vue/dist/vue.js'
6060
}
6161
}
6262
```
6363

6464
对于Browserify,可以用 [aliasify](https://github.com/benbria/aliasify)
6565

66-
<p class="tip">Do NOT do `import Vue from 'vue/dist/vue.common.js'` - since some tools or 3rd party libraries may import vue as well, this may cause the app to load both the runtime and standalone builds at the same time and lead to errors.</p>
66+
<p class="tip">Do NOT do `import Vue from 'vue/dist/vue.js'` - since some tools or 3rd party libraries may import vue as well, this may cause the app to load both the runtime and standalone builds at the same time and lead to errors.</p>
6767

6868
### CSP environments
6969

src/guide/migration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ function pluralizeKnife (count) {
990990
if (count === 0) {
991991
return 'no knives'
992992
} else if (count === 1) {
993-
return count + 'knife'
993+
return '1 knife'
994994
} else {
995995
return count + 'knives'
996996
}

src/guide/single-file-components.md

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ After you've taken a day to dive into these resources, we recommend checking out
4949

5050
The template uses [Webpack](https://webpack.github.io/), a module bundler that takes a number of "modules" and then bundle them into your final application. To learn more about Webpack itself, [this video](https://www.youtube.com/watch?v=WQue1AN93YU) offers a good intro. Once you get past the basics, you might also want to check out [this advanced Webpack course on Egghead.io](https://egghead.io/courses/using-webpack-for-production-javascript-applications).
5151

52-
In Webpack, each module can be transformed by a "loader" before included into the bundle, and Vue offers the [vue-loader](https://github.com/vuejs/vue-loader) plugin to take care of translating `.vue` single-file components. The [webpack-simple](https://github.com/vuejs-templates/webpack-simple) template has already set up everything for you, but if you'd like to learn more about how `.vue` components work with Webpack, you can read [the docs for vue-loader](vue-loader.vuejs.org).
52+
In Webpack, each module can be transformed by a "loader" before included into the bundle, and Vue offers the [vue-loader](https://github.com/vuejs/vue-loader) plugin to take care of translating `.vue` single-file components. The [webpack-simple](https://github.com/vuejs-templates/webpack-simple) template has already set up everything for you, but if you'd like to learn more about how `.vue` components work with Webpack, you can read [the docs for vue-loader](https://vue-loader.vuejs.org).
5353

5454
### For Advanced Users
5555

@@ -99,25 +99,3 @@ NODE_ENV=production browserify -g envify -e main.js | uglifyjs -c -m > build.js
9999
``` bash
100100
NODE_ENV=production browserify -g envify -p [ vueify/plugins/extract-css -o build.css ] -e main.js | uglifyjs -c -m > build.js
101101
```
102-
103-
### Use the Runtime-Only Build
104-
105-
There are two builds available, the standalone build and the runtime-only build.
106-
107-
- The standalone build includes the compiler and supports the `template` option.
108-
109-
- The runtime-only build does not include the template compiler, and does not support the `template` option. You can only use the `render` option when using the runtime-only build, but it works with single-file components, because single-file components' templates are pre-compiled into `render` functions during the build step. The runtime-only build is roughly 30% lighter-weight than the standalone build, weighing only 16kb min+gzip.
110-
111-
By default, the NPM package exports the standalone build. To use the runtime-only build, add the following alias to your webpack config:
112-
113-
``` js
114-
resolve: {
115-
alias: {
116-
vue: 'vue/dist/vue.common.js'
117-
}
118-
}
119-
```
120-
121-
For Browserify, you can use [aliasify](https://github.com/benbria/aliasify) to achieve the same.
122-
123-
<p class="tip">Do NOT do `import Vue from 'vue/dist/vue.common.js'` - since some tools or 3rd party libraries may import vue as well, this may cause the app to load both the runtime and standalone builds at the same time and lead to errors.</p>

src/guide/ssr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ server.listen(5000, function (error) {
207207
})
208208
```
209209

210-
这样就完成了。[整个示例](https://github.com/chrisvfritz/vue-ssr-demo-simple),克隆下来深度实验。一个它在本地运行时,你可以通过在页面右击选择`页面资源`(或类似操作)确认服务选渲染真的运行了。可以在body中看到:
210+
这样就完成了。[整个示例](https://github.com/chrisvfritz/vue-ssr-demo-simple),克隆下来深度实验。一旦它在本地运行时,你可以通过在页面右击选择`页面资源`(或类似操作)确认服务选渲染真的运行了。可以在body中看到:
211211

212212
``` html
213213
<div id="app" server-rendered="true">You have been here for 0 seconds&period;</div>

src/guide/unit-testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ import MyComponent from './MyComponent.vue'
9393

9494
// helper function that mounts and returns the rendered text
9595
function getRenderedText (Component, propsData) {
96-
const Ctor = Vue.extend(MyComponent)
96+
const Ctor = Vue.extend(Component)
9797
const vm = new Ctor({ propsData }).$mount()
9898
return vm.$el.textContent
9999
}

themes/vue/_config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
google_analytics: UA-46852172-1
1+
google_analytics:
22
root_domain: vuefe.cn
3-
vue_version: 2.0正式版
3+
vue_version: 2.0.1

themes/vue/source/css/_sidebar.styl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
display none
5959
padding-left 0
6060

61-
@media screen and (max-width: 720px)
61+
@media screen and (max-width: 900px)
6262
.sidebar
6363
position fixed
6464
z-index 8

themes/vue/source/css/page.styl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
bottom 12px
219219
left 140px
220220

221-
@media screen and (max-width: 720px)
221+
@media screen and (max-width: 900px)
222222
#ad
223223
width 100%
224224
body
@@ -240,7 +240,7 @@
240240
padding 1.2em 1em
241241
.content
242242
&.with-sidebar
243-
margin-left 0
243+
margin auto
244244
.footer
245245
margin-left 0
246246
text-align center

0 commit comments

Comments
 (0)