Skip to content

Commit 08d5948

Browse files
committed
Merge remote-tracking branch 'upstream/master'
# Conflicts: # src/v2/guide/comparison.md # src/v2/guide/installation.md # themes/vue/layout/index.ejs # themes/vue/layout/partials/main_menu.ejs # themes/vue/layout/partials/sidebar.ejs
2 parents 50a0567 + 9d7aaf9 commit 08d5948

File tree

13 files changed

+73
-35
lines changed

13 files changed

+73
-35
lines changed

Diff for: src/v2/guide/components.md

+11
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,17 @@ Vue.component(
10201020
)
10211021
```
10221022

1023+
When using [local registration](https://vuejs.org/v2/guide/components.html#Local-Registration), you can also directly provide a function that returns a `Promise`:
1024+
1025+
``` js
1026+
new Vue({
1027+
// ...
1028+
components: {
1029+
'my-component': () => import('./my-async-component')
1030+
}
1031+
})
1032+
```
1033+
10231034
<p class="tip">If you're a <strong>Browserify</strong> user that would like to use async components, its creator has unfortunately [made it clear](https://github.com/substack/node-browserify/issues/58#issuecomment-21978224) that async loading "is not something that Browserify will ever support." Officially, at least. The Browserify community has found [some workarounds](https://github.com/vuejs/vuejs.org/issues/620), which may be helpful for existing and complex applications. For all other scenarios, we recommend simply using Webpack for built-in, first-class async support.</p>
10241035

10251036
### Component Naming Conventions

Diff for: src/v2/guide/events.md

+2
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ For example:
261261
<div @click.ctrl="doSomething">Do something</div>
262262
```
263263

264+
<p class="tip">Note that modifier keys are different from regular keys and when used with `keyup` events, they have to be pressed when the event is emitted. In other words, `keyup.ctrl` will only trigger if you release a key while holding down `ctrl`. It won't trigger if you release the `ctrl` key alone.</p>
265+
264266
## Why Listeners in HTML?
265267

266268
You might be concerned that this whole event listening approach violates the good old rules about "separation of concerns". Rest assured - since all Vue handler functions and expressions are strictly bound to the ViewModel that's handling the current view, it won't cause any maintenance difficulty. In fact, there are several benefits in using `v-on`:

Diff for: src/v2/guide/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Il suffit de télécharger et de l'inclure avec une balise script. `Vue` sera d
3333

3434
Recommandé: [unpkg](https://unpkg.com/vue/dist/vue.js), qui reflète la dernière version aussitôt qu'elle est publiée sur NPM. Vous pouvez également parcourir la source du package NPM sur [unpkg.com/vue/](https://unpkg.com/vue/).
3535

36-
Également disponible sur [jsDelivr](//cdn.jsdelivr.net/vue/{{vue_version}}/vue.js) ou [cdnjs](//cdnjs.cloudflare.com/ajax/libs/vue/{{vue_version}}/vue.js), mais ces deux services mettent du temps à se synchroniser ce qui signifie que la dernière version peut ne pas être encore disponible.
36+
Également disponible sur [jsDelivr](//cdn.jsdelivr.net/vue/latest/vue.js) ou [cdnjs](//cdnjs.cloudflare.com/ajax/libs/vue/{{vue_version}}/vue.js), mais ces deux services mettent du temps à se synchroniser ce qui signifie que la dernière version peut ne pas être encore disponible.
3737

3838
## NPM
3939

Diff for: themes/vue/layout/index.ejs

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<div id="hero">
88
<div class="inner">
99
<div class="left">
10-
<img class="hero-logo" src="/images/logo.png">
10+
<img class="hero-logo" src="<%- url_for("/images/logo.png") %>">
1111
</div><div class="right">
1212
<h2 class="vue">Vue.js</h2>
1313
<h1>
1414
Le Framework<br>JavaScript Évolutif
1515
</h1>
1616
<p>
17-
<a class="button" href="/v2/guide/">COMMENCER</a>
17+
<a class="button" href="<%- url_for("/v2/guide/") %>">COMMENCER</a>
1818
<a class="button white" href="https://github.com/vuejs/vue" target="_blank">GITHUB</a>
1919
</p>
2020
</div>
@@ -49,7 +49,11 @@
4949
<h3>FIÈREMENT SPONSORISÉ PAR</h3>
5050
<%- partial('partials/sponsors') %>
5151
<br>
52+
<<<<<<< HEAD
5253
<a class="become-sponsor button white" href="/support-vuejs/">Apporter son soutien</a>
54+
=======
55+
<a class="become-sponsor button white" href="<%- url_for("/support-vuejs/") %>">Become a Backer</a>
56+
>>>>>>> upstream/master
5357
</div>
5458
</div>
5559

Diff for: themes/vue/layout/layout.ejs

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
<meta property="og:type" content="article">
1111
<meta property="og:title" content="<%- page.title ? page.title + ' — ' : '' %>Vue.js">
1212
<meta property="og:description" content="<%- theme.site_description %>">
13-
<meta property="og:image" content="https://<%- theme.root_domain %>/images/logo.png">
13+
<meta property="og:image" content="https://<%- theme.root_domain %>/<%- url_for("/images/logo.png") %>">
1414

1515
<meta name="twitter:card" content="summary">
1616
<meta name="twitter:title" content="<%- page.title ? page.title + ' — ' : '' %>Vue.js">
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">
20+
<link rel="icon" href="<%- url_for("/images/logo.png") %>" type="image/x-icon">
2121

2222
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'>
2323
<link href='//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js' rel='stylesheet' type='text/css'>
@@ -26,7 +26,7 @@
2626
<link rel="stylesheet" href="/<%- isIndex ? 'css/index' : 'css/page' %>.css">
2727

2828
<!-- this needs to be loaded before guide's inline scripts -->
29-
<script src="/js/vue.js"></script>
29+
<script src="<%- url_for("/js/vue.js") %>"></script>
3030
<script>window.PAGE_TYPE = "<%- page.type %>"</script>
3131

3232
<!-- ga -->
@@ -54,14 +54,14 @@
5454
<%- body %>
5555
<% } %>
5656
</div>
57-
<script src="/js/smooth-scroll.min.js"></script>
57+
<script src="<%- url_for("/js/smooth-scroll.min.js") %>"></script>
5858
<% } else { %>
5959
<%- body %>
6060
<% } %>
6161

6262
<!-- main custom script for sidebars, version selects etc. -->
63-
<script src="/js/css.escape.js"></script>
64-
<script src="/js/common.js"></script>
63+
<script src="<%- url_for("/js/css.escape.js") %>"></script>
64+
<script src="<%- url_for("/js/common.js") %>"></script>
6565

6666
<!-- search -->
6767
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>

Diff for: themes/vue/layout/partials/ad.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- <span>Sponsored By</span><br>
33
<a href="http://www.thedifferenceengine.io/" target="_blank"
44
style="background-color: rgba(0,0,0,.85); padding: 10px 0">
5-
<img src="/images/tde.png">
5+
<img src="<%- url_for("/images/tde.png") %>">
66
</a> -->
77
<script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=vuejs" id="_carbonads_js"></script>
88
</div>

Diff for: themes/vue/layout/partials/header.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div id="header">
2-
<a id="logo" href="/">
3-
<img src="/images/logo.png">
2+
<a id="logo" href="<%- url_for("/") %>">
3+
<img src="<%- url_for("/images/logo.png") %>">
44
<span>Vue.js</span>
55
</a>
66
<ul id="nav">

Diff for: themes/vue/layout/partials/main_menu.ejs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<input type="text" id="search-query-<%- context %>" class="search-query st-default-search-input">
44
</form>
55
</li>
6-
<li><a href="/v2/guide/" class="nav-link<%- page.path.match(/guide/) ? ' current' : '' %>">Guide</a></li>
7-
<li><a href="/v2/api/" class="nav-link<%- page.path.match(/api/) ? ' current' : '' %>">API</a></li>
8-
<li><a href="/v2/examples/" class="nav-link<%- page.path.match(/examples/) ? ' current' : '' %>">Exemples</a></li>
6+
<li><a href="<%- url_for("/v2/guide/") %>" class="nav-link<%- page.path.match(/guide/) ? ' current' : '' %>">Guide</a></li>
7+
<li><a href="<%- url_for("/v2/api/") %>" class="nav-link<%- page.path.match(/api/) ? ' current' : '' %>">API</a></li>
8+
<li><a href="<%- url_for("/v2/examples/") %>" class="nav-link<%- page.path.match(/examples/) ? ' current' : '' %>">Exemples</a></li>
99
<%- partial('partials/ecosystem_dropdown') %>
1010
<%- partial('partials/language_dropdown') %>

Diff for: themes/vue/layout/partials/sidebar.ejs

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<span>Sponsorisé par</span><br>
88
<a href="http://www.thedifferenceengine.io/" target="_blank"
99
style="background-color: #f3f3f3; padding: 10px 0">
10-
<img src="/images/tde.png">
10+
<img src="<%- url_for("/images/tde.png") %>">
1111
</a>
1212
</div>
13-
<a class="become-backer" href="/support-vuejs">
13+
<a class="become-backer" href="<%- url_for("/support-vuejs") %>">
1414
Apporter son soutien
1515
</a>
1616
<h2>
@@ -49,7 +49,7 @@
4949
<!-- at least one recipe -->
5050
<% } %>
5151
<li>
52-
<a href="/<%- p.path %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
52+
<a href="<%- url_for(p.path) %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
5353
</li>
5454
<% }) %>
5555
<% if (type === 'cookbook') { %>

Diff for: themes/vue/layout/partials/sponsors.ejs

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
<a class="vip" href="http://www.thedifferenceengine.io/" target="_blank">
2-
<img src="/images/tde.png">
2+
<img src="<%- url_for("/images/tde.png") %>">
33
</a>
44
<a href="https://jsfiddle.net/" target="_blank">
5-
<img src="/images/jsfiddle.png">
5+
<img src="<%- url_for("/images/jsfiddle.png") %>">
66
</a>
77
<a href="https://laravel.com/" target="_blank">
8-
<img src="/images/laravel.png">
8+
<img src="<%- url_for("/images/laravel.png") %>">
99
</a>
1010
<a href="https://chaitin.cn" target="_blank" style="top:-1px">
11-
<img src="/images/chaitin.png">
11+
<img src="<%- url_for("/images/chaitin.png") %>">
1212
</a>
1313
<a href="https://htmlburger.com" target="_blank">
14-
<img src="/images/htmlburger.png">
14+
<img src="<%- url_for("/images/htmlburger.png") %>">
1515
</a>
1616
<a href="https://starter.someline.com/" target="_blank" style="top:-2px">
17-
<img src="/images/someline.png">
17+
<img src="<%- url_for("/images/someline.png") %>">
1818
</a>
1919
<a href="http://monterail.com/" target="_blank">
20-
<img src="/images/monterail.png">
20+
<img src="<%- url_for("/images/monterail.png") %>">
2121
</a>
2222
<a href="https://www.trisoft.ro/" target="_blank" style="width:80px;top:-2px">
23-
<img src="/images/trisoft.png" style="width:80px">
23+
<img src="<%- url_for("/images/trisoft.png") %>" style="width:80px">
2424
</a>
2525
<a href="http://actualize.co/" target="_blank" style="width:144px;">
26-
<img src="/images/actualize.png" style="width:144px">
26+
<img src="<%- url_for("/images/actualize.png") %>" style="width:144px">
2727
</a>
2828
<a href="https://www.2mhost.com/" target="_blank" style="width:90px">
29-
<img src="/images/2mhost.png" style="width:90px">
29+
<img src="<%- url_for("/images/2mhost.png") %>" style="width:90px">
3030
</a>
3131
<a href="https://vuejobs.com/?ref=vuejs" target="_blank" style="width:90px;top:5px">
32-
<img src="/images/vuejobs.png" style="width:90px">
32+
<img src="<%- url_for("/images/vuejobs.png") %>" style="width:90px">
3333
</a>
3434
<a href="https://leanpub.com/vuejs2" target="_blank">
35-
<img src="/images/tmvuejs2.png">
35+
<img src="<%- url_for("/images/tmvuejs2.png") %>">
3636
</a>
3737
<a href="https://stdlib.com/" target="_blank" style="width:80px">
38-
<img src="/images/stdlib.png">
38+
<img src="<%- url_for("/images/stdlib.png") %>">
3939
</a>

Diff for: themes/vue/layout/post.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<div class="list">
66
<h2>
77
Recent Posts
8-
<a href="/atom.xml" target="_blank" style="vertical-align: middle; margin-left: 5px">
9-
<img src="/images/feed.png" style="width:15px;height:15px">
8+
<a href="<%- url_for("/atom.xml") %>" target="_blank" style="vertical-align: middle; margin-left: 5px">
9+
<img src="<%- url_for("/images/feed.png") %>" style="width:15px;height:15px">
1010
</a>
1111
</h2>
1212
<ul style="padding:0">

Diff for: themes/vue/source/css/_header.styl

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ body.docs
4747
border-radius 15px
4848
margin-right 10px
4949
transition border-color .2s ease
50-
background #fff url(/images/search.png) 8px 5px no-repeat
50+
background #fff url(../images/search.png) 8px 5px no-repeat
5151
background-size 20px
5252
vertical-align middle !important
5353
&:focus

Diff for: themes/vue/source/js/common.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
}
9292

9393
/**
94-
* Mobile burger menu button for toggling sidebar
94+
* Mobile burger menu button and gesture for toggling sidebar
9595
*/
9696

9797
function initMobileMenu () {
@@ -108,6 +108,27 @@
108108
sidebar.classList.remove('open')
109109
}
110110
})
111+
112+
// Toggle sidebar on swipe
113+
var start = {}, end = {}
114+
115+
document.body.addEventListener('touchstart', function (e) {
116+
start.x = e.changedTouches[0].clientX
117+
start.y = e.changedTouches[0].clientY
118+
})
119+
120+
document.body.addEventListener('touchend', function (e) {
121+
end.y = e.changedTouches[0].clientY
122+
end.x = e.changedTouches[0].clientX
123+
124+
var xDiff = end.x - start.x
125+
var yDiff = end.y - start.y
126+
127+
if (Math.abs(xDiff) > Math.abs(yDiff)) {
128+
if (xDiff > 0) sidebar.classList.add('open')
129+
else sidebar.classList.remove('open')
130+
}
131+
})
111132
}
112133

113134
/**

0 commit comments

Comments
 (0)