Skip to content

Commit 5ba2531

Browse files
committed
获取官方更新
2 parents df97550 + 0e49e03 commit 5ba2531

File tree

12 files changed

+118
-91
lines changed

12 files changed

+118
-91
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393

9494
### Vuex 2.0
9595
翻译已完成 <br />
96-
校对中 <br />
9796

9897
### webpack2
9998
翻译中 [webpack.js.org](https://github.com/vuefe/webpack2) <br />

src/v2/api/index.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ type: api
10231023

10241024
- **用法:**
10251025

1026-
观察 Vue 实例变化的一个表达式或计算属性函数。回调函数的得到参数为新值和旧值。表达式可以是某个键路径或任意合法绑定表达式
1026+
观察 Vue 实例变化的一个表达式或计算属性函数。回调函数得到的参数为新值和旧值。表达式只接受监督的键路径。对于更复杂的表达式,用一个函数取代
10271027

10281028
<p class="tip">注意:在变异(不是替换)对象或数组时,旧值将与新值相同,因为它们的引用指向同一个对象/数组。Vue 不会保留变异之前值的副本。</p>
10291029

@@ -1035,11 +1035,6 @@ type: api
10351035
// 做点什么
10361036
})
10371037

1038-
// 表达式
1039-
vm.$watch('a + b', function (newVal, oldVal) {
1040-
// 做点什么
1041-
})
1042-
10431038
// 函数
10441039
vm.$watch(
10451040
function () {

src/v2/guide/index.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Vue.js 的目标是通过尽可能简单的 API 实现**响应的数据绑定**
1414

1515
## 起步
1616

17-
<p class="tip">The official guide assumes intermediate level front-end knowledge of HTML, CSS and JavaScript. If you are totally new to front-end development, it might not be the best idea to jump right into a framework as your first step - grasp the basics then come back! Prior experience with other frameworks helps, but is not required.</p>
17+
<p class="tip">The official guide assumes intermediate level knowledge of HTML, CSS, and JavaScript. If you are totally new to frontend development, it might not be the best idea to jump right into a framework as your first step - grasp the basics then come back! Prior experience with other frameworks helps, but is not required.</p>
1818

1919
The easiest way to try out Vue.js is using the [JSFiddle Hello World 例子](https://jsfiddle.net/chrisvfritz/50wL7mdz/). Feel free to open it in another tab and follow along as we go through some basic examples. Or, you can simply create an `.html` file and include Vue with:
2020

@@ -271,9 +271,7 @@ Vue.component('todo-item', {
271271

272272
``` html
273273
<ul>
274-
<!--
275-
Create an instance of the todo-item component
276-
-->
274+
<!-- Create an instance of the todo-item component -->
277275
<todo-item></todo-item>
278276
</ul>
279277
```
@@ -295,11 +293,9 @@ Vue.component('todo-item', {
295293
``` html
296294
<div id="app-7">
297295
<ol>
298-
<!--
299-
Now we provide each todo-item with the todo object
300-
it's representing, so that its content can be dynamic
301-
-->
302-
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
296+
<!-- Now we provide each todo-item with the todo object -->
297+
<!-- it's representing, so that its content can be dynamic -->
298+
<todo-item v-for="item in groceryList" v-bind:todo="item"></todo-item>
303299
</ol>
304300
</div>
305301
```
@@ -309,21 +305,22 @@ Vue.component('todo-item', {
309305
props: ['todo'],
310306
template: '<li>{{ todo.text }}</li>'
311307
})
308+
312309
var app7 = new Vue({
313310
el: '#app-7',
314311
data: {
315-
todos: [
316-
{ text: 'Learn JavaScript' },
317-
{ text: 'Learn Vue' },
318-
{ text: 'Build something awesome' }
312+
groceryList: [
313+
{ text: 'Vegetables' },
314+
{ text: 'Cheese' },
315+
{ text: 'Whatever else humans are supposed to eat' }
319316
]
320317
}
321318
})
322319
```
323320
{% raw %}
324321
<div id="app-7" class="demo">
325322
<ol>
326-
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
323+
<todo-item v-for="item in groceryList" v-bind:todo="item"></todo-item>
327324
</ol>
328325
</div>
329326
<script>
@@ -334,10 +331,10 @@ Vue.component('todo-item', {
334331
var app7 = new Vue({
335332
el: '#app-7',
336333
data: {
337-
todos: [
338-
{ text: 'Learn JavaScript' },
339-
{ text: 'Learn Vue' },
340-
{ text: 'Build something awesome' }
334+
groceryList: [
335+
{ text: 'Vegetables' },
336+
{ text: 'Cheese' },
337+
{ text: 'Whatever else humans are supposed to eat' }
341338
]
342339
}
343340
})

src/v2/guide/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ vue_version: 2.0.5
66
dev_size: "194.65"
77
min_size: "64.28"
88
gz_size: "23.55"
9-
ro_gz_size: "16"
9+
ro_gz_size: "16.39"
1010
---
1111

1212
### 兼容性

src/v2/guide/reactivity.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ vm.message = 'Hello!'
7676

7777
## 异步更新队列
7878

79-
你应该注意到 Vue 执行 DOM 更新是**异步的**,只要观察到数据变化,Vue 就开始一个队列,将同一事件循环内所有的数据变化缓存起来。如果一个 watcher 被多次触发,只会推入一次到队列中。然后,在接下来的事件循环中,Vue 刷新队列并仅执行必要的 DOM 更新。Vue 在内部使用 `Promise.then``MutationObserver` 为可用的异步队列调用回调 `setTimeout(fn, 0)`.
79+
你应该注意到 Vue 执行 DOM 更新是**异步的**,只要观察到数据变化,Vue 就开始一个队列,将同一事件循环内所有的数据变化缓存起来。如果一个 watcher 被多次触发,只会推入一次到队列中。然后,在接下来的事件循环中,Vue 刷新队列并仅执行必要的 DOM 更新。Vue 在内部尝试利用原生的 `Promise.then``MutationObserver` 来调用异步队列,如果执行环境不兼容,会采用 `setTimeout(fn, 0)` 代替。
8080

81-
例如,当你设置 `vm.someData = 'new value'`,该组件不会马上被重新渲染。当刷新队列时,这个组件会在下一次事件循环清空队列时更新。我们基本不用关心这个过程,但是如果你想在 DOM 状态更新后做点什么,这就可能会有些棘手。一般来讲,Vue 鼓励开发者沿着数据驱动的思路,尽量避免直接接触 DOM,但是有时我们确实要这么做。为了在数据变化之后等待 Vue 完成更新 DOM,可以在数据变化之后立即使用 `Vue.nextTick(callback)`。这样回调在 DOM 更新完成后就会调用。例如:
81+
例如,当你设置 `vm.someData = 'new value'` ,该组件不会马上被重新渲染。当刷新队列时,这个组件会在下一次事件循环清空队列时更新。我们基本不用关心这个过程,但是如果你想在 DOM 状态更新后做点什么,这就可能会有些棘手。一般来讲, Vue 鼓励开发者沿着数据驱动的思路,尽量避免直接接触 DOM,但是有时我们确实要这么做。为了在数据变化之后等待 Vue 完成更新 DOM ,可以在数据变化之后立即使用 `Vue.nextTick(callback)` 。这样回调在 DOM 更新完成后就会调用。例如:
8282

8383
```html
8484
<div id="example">{{message}}</div>
@@ -96,7 +96,7 @@ Vue.nextTick(function () {
9696
vm.$el.textContent === 'new message' // true
9797
})
9898
```
99-
`vm.$nextTick()` 这个实例方法在组件内使用特别方便,因为它不需要全局 `Vue`,它的回调 `this` 将自动绑定到当前的 Vue 实例上:
99+
`vm.$nextTick()` 这个实例方法在组件内使用特别方便,因为它不需要全局 `Vue` ,它的回调 `this` 将自动绑定到当前的 Vue 实例上:
100100
``` js
101101
Vue.component('example', {
102102
template: '<span>{{ message }}</span>',

themes/vue/layout/index.ejs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
Copyright &copy; 2014-<%- new Date().getFullYear() %> Evan You
6161
</div>
6262

63-
<script src="/js/common.js"></script>
6463
<script>
6564
var topScrolled = false
6665
window.addEventListener('scroll', function () {

themes/vue/layout/layout.ejs

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
<meta name="twitter:description" content="<%- theme.site_description %>">
1818
<meta name="twitter:image" content="https://<%- theme.root_domain %>/images/logo.png">
1919

20+
<link rel="icon" href="/images/logo.png" type="image/x-icon">
21+
2022
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
2123
<link href='//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js' rel='stylesheet' type='text/css'>
22-
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
23-
<link rel="icon" href="/images/logo.png" type="image/x-icon">
24-
<script>
25-
window.PAGE_TYPE = "<%- page.type %>"
26-
</script>
24+
25+
<!-- main page styles -->
2726
<%- css(isIndex ? 'css/index' : 'css/page') %>
28-
<%- partial('partials/ga') %>
27+
28+
<!-- this needs to be loaded before guide's inline scripts -->
2929
<script src="/js/vue.js"></script>
30+
<script>window.PAGE_TYPE = "<%- page.type %>"</script>
3031
</head>
3132
<body class="<%- isIndex ? '' : 'docs' -%>">
3233
<div id="mobile-bar" <%- isIndex ? 'class="top"' : '' %>>
@@ -44,16 +45,49 @@
4445
</div>
4546
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
4647
<script src="/js/smooth-scroll.min.js"></script>
47-
<script src="/js/common.js"></script>
4848
<% } else { %>
4949
<%- body %>
5050
<% } %>
5151

52+
<!-- main custom script for sidebars, version selects etc. -->
53+
<script src="/js/common.js"></script>
54+
55+
<!-- ga -->
56+
<script>
57+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
58+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
59+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
60+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
61+
62+
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
63+
ga('send', 'pageview');
64+
</script>
65+
66+
<!-- search -->
67+
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
68+
<%- css('css/search') %>
69+
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
70+
<script>
71+
[
72+
'#search-query-nav',
73+
'#search-query-sidebar'
74+
].forEach(function (selector) {
75+
if (!document.querySelector(selector)) return
76+
docsearch({
77+
appId: 'BH4D9OD16A',
78+
apiKey: '85cc3221c9f23bfbaa4e3913dd7625ea',
79+
indexName: 'vuejs',
80+
inputSelector: selector
81+
})
82+
})
83+
</script>
84+
85+
<!-- fastclick -->
5286
<script src="//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js"></script>
5387
<script>
54-
document.addEventListener('DOMContentLoaded', function() {
55-
FastClick.attach(document.body);
56-
}, false);
88+
document.addEventListener('DOMContentLoaded', function() {
89+
FastClick.attach(document.body)
90+
}, false)
5791
</script>
5892
</body>
5993
</html>

themes/vue/source/css/index.styl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@import "_common"
22
@import "_header"
3-
@import "_search"
43
@import '_sidebar'
54

65
$width = 900px

themes/vue/source/css/page.styl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import "_common"
22
@import "_header"
33
@import "_demo"
4-
@import "_search"
54
@import "_sponsor"
65
@import "_migration"
76
@import "_sidebar"
@@ -111,7 +110,7 @@
111110
font-weight bold
112111
font-family $logo-font
113112
font-size 14px
114-
113+
115114
code
116115
background-color #efefef
117116

0 commit comments

Comments
 (0)