Skip to content

Commit dcccce6

Browse files
committed
获取官方更新
2 parents b6f4de7 + 7cd45cf commit dcccce6

File tree

11 files changed

+64
-71
lines changed

11 files changed

+64
-71
lines changed

src/v2/api/index.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
10171017

10181018
- **Usage:**
10191019

1020-
Watch an expression or a computed function on the Vue instance for changes. The callback gets called with the new value and the old value. The expression can be a single keypath or any valid binding expressions.
1020+
Watch an expression or a computed function on the Vue instance for changes. The callback gets called with the new value and the old value. The expression only accepts simple dot-delimited paths. For more complex expression, use a function instead.
10211021

10221022
<p class="tip">Note: when mutating (rather than replacing) an Object or an Array, the old value will be the same as new value because they reference the same Object/Array. Vue doesn't keep a copy of the pre-mutate value.</p>
10231023

@@ -1029,11 +1029,6 @@ All lifecycle hooks automatically have their `this` context bound to the instanc
10291029
// do something
10301030
})
10311031

1032-
// expression
1033-
vm.$watch('a + b', function (newVal, oldVal) {
1034-
// do something
1035-
})
1036-
10371032
// function
10381033
vm.$watch(
10391034
function () {

src/v2/guide/index.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ If you are an experienced frontend developer and want to know how Vue compares t
1212

1313
## Getting Started
1414

15-
<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>
15+
<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>
1616

1717
The easiest way to try out Vue.js is using the [JSFiddle Hello World example](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:
1818

@@ -271,9 +271,7 @@ Now you can compose it in another component's template:
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 @@ Now we can pass the todo into each repeated component using `v-bind`:
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
```
@@ -308,21 +304,22 @@ Vue.component('todo-item', {
308304
props: ['todo'],
309305
template: '<li>{{ todo.text }}</li>'
310306
})
307+
311308
var app7 = new Vue({
312309
el: '#app-7',
313310
data: {
314-
todos: [
315-
{ text: 'Learn JavaScript' },
316-
{ text: 'Learn Vue' },
317-
{ text: 'Build something awesome' }
311+
groceryList: [
312+
{ text: 'Vegetables' },
313+
{ text: 'Cheese' },
314+
{ text: 'Whatever else humans are supposed to eat' }
318315
]
319316
}
320317
})
321318
```
322319
{% raw %}
323320
<div id="app-7" class="demo">
324321
<ol>
325-
<todo-item v-for="todo in todos" v-bind:todo="todo"></todo-item>
322+
<todo-item v-for="item in groceryList" v-bind:todo="item"></todo-item>
326323
</ol>
327324
</div>
328325
<script>
@@ -333,10 +330,10 @@ Vue.component('todo-item', {
333330
var app7 = new Vue({
334331
el: '#app-7',
335332
data: {
336-
todos: [
337-
{ text: 'Learn JavaScript' },
338-
{ text: 'Learn Vue' },
339-
{ text: 'Build something awesome' }
333+
groceryList: [
334+
{ text: 'Vegetables' },
335+
{ text: 'Cheese' },
336+
{ text: 'Whatever else humans are supposed to eat' }
340337
]
341338
}
342339
})

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
### Compatibility Note

themes/vue/layout/index.ejs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
Copyright &copy; 2014-<%- new Date().getFullYear() %> Evan You
5959
</div>
6060

61-
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
62-
<script src="/js/common.js"></script>
6361
<script>
6462
var topScrolled = false
6563
window.addEventListener('scroll', function () {

themes/vue/layout/layout.ejs

Lines changed: 44 additions & 11 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"' : '' %>>
@@ -42,18 +43,50 @@
4243
<%- body %>
4344
<% } %>
4445
</div>
45-
<script src="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
4646
<script src="/js/smooth-scroll.min.js"></script>
47-
<script src="/js/common.js"></script>
4847
<% } else { %>
4948
<%- body %>
5049
<% } %>
5150

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

themes/vue/layout/partials/ga.ejs

Lines changed: 0 additions & 9 deletions
This file was deleted.

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

themes/vue/source/js/common.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(function () {
22

3-
initSearch()
43
initMobileMenu()
54
if (PAGE_TYPE) {
65
initVersionSelect()
@@ -74,25 +73,6 @@
7473
}
7574
}
7675

77-
/**
78-
* Swiftype search box
79-
*/
80-
81-
function initSearch () {
82-
[
83-
'#search-query-nav',
84-
'#search-query-sidebar'
85-
].forEach(function (selector) {
86-
if (!document.querySelector(selector)) return
87-
docsearch({
88-
appId: 'BH4D9OD16A',
89-
apiKey: '85cc3221c9f23bfbaa4e3913dd7625ea',
90-
indexName: 'vuejs',
91-
inputSelector: selector
92-
})
93-
})
94-
}
95-
9676
/**
9777
* Mobile burger menu button for toggling sidebar
9878
*/

update.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ fs.writeFileSync(
1313
var sizes = {
1414
dev: 'vue.js',
1515
min: 'vue.min.js',
16-
gz: 'vue.min.js.gz'
16+
gz: 'vue.min.js.gz',
17+
ro_gz: 'vue.common.min.js.gz'
1718
}
1819

1920
for (var file in sizes) {

0 commit comments

Comments
 (0)