Skip to content

Commit 73d5cbe

Browse files
authored
Merge pull request #33 from vuejs/master
2.0 合并
2 parents d965b69 + 8ed1355 commit 73d5cbe

21 files changed

+78
-75
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ var app3 = new Vue({
115115

116116
Go ahead and enter `app3.seen = false` in the console. You should see the message disappear.
117117

118-
This second example demonstrates that we can bind data to not only text and attributes, but also the **structure** of the DOM. Moreover, Vue also provides a powerful transition effect system that can automatically apply [transition effects](transitions.html) when elements are inserted/updated/removed by Vue.
118+
This example demonstrates that we can bind data to not only text and attributes, but also the **structure** of the DOM. Moreover, Vue also provides a powerful transition effect system that can automatically apply [transition effects](transitions.html) when elements are inserted/updated/removed by Vue.
119119

120120
There are quite a few other directives, each with its own special functionality. For example, the `v-for` directive can be used for displaying a list of items using the data from an Array:
121121

@@ -249,7 +249,8 @@ The component system is another important concept in Vue, because it's an abstra
249249
In Vue, a component is essentially a Vue instance with pre-defined options. Registering a component in Vue is straightforward:
250250

251251
``` js
252-
Vue.component('todo', {
252+
// Define a new component called todo-item
253+
Vue.component('todo-item', {
253254
template: '<li>This is a todo</li>'
254255
})
255256
```
@@ -258,14 +259,21 @@ Now you can compose it in another component's template:
258259

259260
``` html
260261
<ul>
261-
<todo v-for="todo in todos"></todo>
262+
<!--
263+
Create an instance of the todo-item component
264+
for each todo in a todos array
265+
-->
266+
<todo-item v-for="todo in todos"></todo-item>
262267
</ul>
263268
```
264269

265270
But this would render the same text for every todo, which is not super interesting. We should be able to pass data from the parent scope into child components. Let's modify the component definition to make it accept a [prop](/guide/components.html#Props):
266271

267272
``` js
268-
Vue.component('todo', {
273+
Vue.component('todo-item', {
274+
// The todo-item component now accepts a
275+
// "prop", which is like a custom attribute.
276+
// This prop is called todo.
269277
props: ['todo'],
270278
template: '<li>{{ todo.text }}</li>'
271279
})
@@ -276,7 +284,11 @@ Now we can pass the todo into each repeated component using `v-bind`:
276284
``` html
277285
<div id="app-7">
278286
<ol>
279-
<todo v-for="todo in todos" v-bind:todo="todo"></todo>
287+
<!--
288+
Now we provide each todo-item with the todo object
289+
it's representing, so that its content can be dynamic
290+
-->
291+
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
280292
</ol>
281293
</div>
282294
```
@@ -291,11 +303,11 @@ var app7 = new Vue({
291303
{% raw %}
292304
<div id="app-7" class="demo">
293305
<ol>
294-
<todo v-for="todo in todos" v-bind:todo="todo"></todo>
306+
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
295307
</ol>
296308
</div>
297309
<script>
298-
Vue.component('todo', {
310+
Vue.component('todo-item', {
299311
props: ['todo'],
300312
template: '<li>{{ todo.text }}</li>'
301313
})
@@ -312,7 +324,7 @@ var app7 = new Vue({
312324
</script>
313325
{% endraw %}
314326

315-
This is just a contrived example, but we have managed to separate our app into two smaller units, and the child is reasonably well-decoupled from the parent via the props interface. We can now further improve our `<todo>` component with more complex template and logic without affecting the parent app.
327+
This is just a contrived example, but we have managed to separate our app into two smaller units, and the child is reasonably well-decoupled from the parent via the props interface. We can now further improve our `<todo-item>` component with more complex template and logic without affecting the parent app.
316328

317329
In a large application, it is necessary to divide the whole app into components to make development manageable. We will talk a lot more about components [later in the guide](/guide/components.html), but here's an (imaginary) example of what an app's template might look like with components:
318330

src/guide/installation.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: Installation
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
### Compatibility Note
@@ -30,7 +30,7 @@ Simply download and include with a script tag. `Vue` will be registered as a glo
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
For Browserify, you can use [aliasify](https://github.com/benbria/aliasify) to achieve the same.
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
@@ -206,7 +206,7 @@ server.listen(5000, function (error) {
206206
})
207207
```
208208

209-
And that's it! Here's [the full application](https://github.com/chrisvfritz/vue-ssr-demo-simple), in case you'd like to clone it and experiment further. Once you have it running locally, you can confirm that server-side rendering really is working by right-clickig on the page and selecting `View Page Source` (or similar). You should see this in the body:
209+
And that's it! Here's [the full application](https://github.com/chrisvfritz/vue-ssr-demo-simple), in case you'd like to clone it and experiment further. Once you have it running locally, you can confirm that server-side rendering really is working by right-clicking on the page and selecting `View Page Source` (or similar). You should see this in the body:
210210

211211
``` html
212212
<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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
google_analytics: UA-46852172-1
22
root_domain: vuejs.org
3-
vue_version: 2.0.0-rc.8
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
@@ -142,7 +142,7 @@
142142
bottom 12px
143143
left 140px
144144

145-
@media screen and (max-width: 720px)
145+
@media screen and (max-width: 900px)
146146
#ad
147147
width 100%
148148
body
@@ -164,7 +164,7 @@
164164
padding 1.2em 1em
165165
.content
166166
&.with-sidebar
167-
margin-left 0
167+
margin auto
168168
.footer
169169
margin-left 0
170170
text-align center

0 commit comments

Comments
 (0)