Skip to content

Commit bff457f

Browse files
authored
Merge branch 'master' into 2.6
2 parents 825c21b + 1a73684 commit bff457f

19 files changed

+298
-236
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ Russian translation is maintained by Translation Gang.
7272

7373
### Spanish
7474

75-
Spanish translation is maintained by VueJS-ES.
75+
Spanish translation is maintained by [1950Labs](https://1950labs.com) and Vue.js Montevideo ([Leonel More](https://twitter.com/leonelmore), [Sebastian Camacho](https://twitter.com/sxcamacho), and [Diana Rodriguez](https://vue.beingadev.rocks).
7676

77-
* Translation Repo - [/vuejs-es/vuejs.org](https://github.com/vuejs-es/vuejs.org)
77+
* Translation Repo - [/1950Labs/vuejs.org](https://github.com/1950Labs/vuejs.org)
7878

7979
### Vietnamese
8080

src/images/vuetron-hierarchy.gif

-3.37 MB
Binary file not shown.

src/v2/api/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,9 @@ type: api
15211521
// function
15221522
vm.$watch(
15231523
function () {
1524+
// everytime the expression `this.a + this.b` yields a different result,
1525+
// the handler will be called. It's as if we were watching a computed
1526+
// property without defining the computed property itself
15241527
return this.a + this.b
15251528
},
15261529
function (newVal, oldVal) {

src/v2/cookbook/debugging-in-vscode.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,6 @@ There are other methods of debugging, varying in complexity. The most popular an
100100

101101
<p class="tip">Please note that if the page uses a production/minified build of Vue.js (such as the standard link from a CDN), devtools inspection is disabled by default so the Vue pane won't show up. If you switch to an unminified version, you may have to give the page a hard refresh to see them.</p>
102102

103-
### Vuetron
104-
105-
[Vuetron](http://vuetron.io/) is a really nice project that extends some of the work that vue-devtools has done. In addition to the normal devtools workflow, you are able to:
106-
107-
* Quickly view API Request/Response: if you're using the fetch API for requests, this event is displayed for any request sent. The expanded card displays the request data as well as the response data.
108-
* Subscribe to specific parts of your application’s state for faster debugging
109-
* Visualize component hierarchy, and an animation allows you to collapse or expand the tree for specific hierarchy views.
110-
111-
![Vuetron Hierarchy](/images/vuetron-hierarchy.gif)
112-
113103
### Simple Debugger Statement
114104

115105
The example above has a great workflow. However, there is an alternative option where you can use the [native debugger statement](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger) directly in your code. If you choose to work this way, it's important that you remember to remove the statements when you're done.

src/v2/cookbook/dockerize-vuejs-app.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ So you built your first Vue.js app using the amazing [Vue.js webpack template](h
1111
Let's start by creating a `Dockerfile` in the root folder of our project:
1212

1313
```docker
14-
FROM node:9.11.1-alpine
14+
FROM node:lts-alpine
1515
1616
# install simple http server for serving static content
1717
RUN npm install -g http-server
@@ -63,15 +63,15 @@ Let's refactor our `Dockerfile` to use NGINX:
6363

6464
```docker
6565
# build stage
66-
FROM node:9.11.1-alpine as build-stage
66+
FROM node:lts-alpine as build-stage
6767
WORKDIR /app
6868
COPY package*.json ./
6969
RUN npm install
7070
COPY . .
7171
RUN npm run build
7272
7373
# production stage
74-
FROM nginx:1.13.12-alpine as production-stage
74+
FROM nginx:stable-alpine as production-stage
7575
COPY --from=build-stage /app/dist /usr/share/nginx/html
7676
EXPOSE 80
7777
CMD ["nginx", "-g", "daemon off;"]

src/v2/cookbook/unit-testing-vue-components.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ export default {
4545

4646
```js
4747
import { shallowMount } from '@vue/test-utils'
48+
import Hello from './Hello.vue'
4849

49-
test('Foo', () => {
50+
test('Hello', () => {
5051
// render the component
5152
const wrapper = shallowMount(Hello)
5253

@@ -144,6 +145,7 @@ And our first attempt at test:
144145

145146
```js
146147
import { shallowMount } from '@vue/test-utils'
148+
import Foo from './Foo.vue'
147149

148150
describe('Foo', () => {
149151
it('renders a message and responds correctly to user input', () => {

src/v2/examples/hackernews.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ order: 12
1414
</div>
1515
{% endraw %}
1616

17-
> [Live Demo](https://vue-hn.now.sh/)
17+
> [Live Demo](https://vue-hn.herokuapp.com/)
1818
> Note: the demo may need some spin up time if nobody has accessed it for a certain period.
1919
>
2020
> [[Source](https://github.com/vuejs/vue-hackernews-2.0)]

src/v2/guide/components.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ Vue.component('blog-post', {
268268

269269
Now, whenever a new property is added to `post` objects, it will automatically be available inside `<blog-post>`.
270270

271-
## Sending Messages to Parents with Events
271+
## Listening to Child Components Events
272272

273273
As we develop our `<blog-post>` component, some features may require communicating back up to the parent. For example, we may decide to include an accessibility feature to enlarge the text of blog posts, while leaving the rest of the page its default size:
274274

@@ -323,15 +323,7 @@ The problem is, this button doesn't do anything:
323323
</button>
324324
```
325325

326-
When we click on the button, we need to communicate to the parent that it should enlarge the text of all posts. Fortunately, Vue instances provide a custom events system to solve this problem. To emit an event to the parent, we can call the built-in [**`$emit`** method](../api/#vm-emit), passing the name of the event:
327-
328-
```html
329-
<button v-on:click="$emit('enlarge-text')">
330-
Enlarge text
331-
</button>
332-
```
333-
334-
Then on our blog post, we can listen for this event with `v-on`, just as we would with a native DOM event:
326+
When we click on the button, we need to communicate to the parent that it should enlarge the text of all posts. Fortunately, Vue instances provide a custom events system to solve this problem. The parent can choose to listen to any event on the child component instance with `v-on`, just as we would with a native DOM event:
335327

336328
```html
337329
<blog-post
@@ -340,6 +332,16 @@ Then on our blog post, we can listen for this event with `v-on`, just as we woul
340332
></blog-post>
341333
```
342334

335+
Then the child component can emit an event on itself by calling the built-in [**`$emit`** method](../api/#vm-emit), passing the name of the event:
336+
337+
```html
338+
<button v-on:click="$emit('enlarge-text')">
339+
Enlarge text
340+
</button>
341+
```
342+
343+
Thanks to the `v-on:enlarge-text="postFontSize += 0.1"` listener, the parent will receive the event and update `postFontSize` value.
344+
343345
{% raw %}
344346
<div id="blog-posts-events-demo" class="demo">
345347
<div :style="{ fontSize: postFontSize + 'em' }">

src/v2/guide/events.md

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -223,24 +223,28 @@ The `.passive` modifier is especially useful for improving performance on mobile
223223

224224
## Key Modifiers
225225

226-
When listening for keyboard events, we often need to check for common key codes. Vue also allows adding key modifiers for `v-on` when listening for key events:
226+
When listening for keyboard events, we often need to check for specific keys. Vue allows adding key modifiers for `v-on` when listening for key events:
227227

228228
``` html
229-
<!-- only call `vm.submit()` when the `keyCode` is 13 -->
230-
<input v-on:keyup.13="submit">
229+
<!-- only call `vm.submit()` when the `key` is PageDown -->
230+
<input @keyup.page-down="onPageDown">
231231
```
232232

233-
Remembering all the `keyCode`s is a hassle, so Vue provides aliases for the most commonly used keys:
233+
In the above example, the handler will only be called if `$event.key` is equal to `'PageDown'`.
234234

235-
``` html
236-
<!-- same as above -->
237-
<input v-on:keyup.enter="submit">
235+
You can directly use any valid key names exposed via [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) as modifiers by converting them to kebab-case.
236+
237+
### Key Codes
238+
239+
<p class="tip">The use of `keyCode` events [is deprecated](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode) and may not be supported in new browsers.</p>
238240

239-
<!-- also works for shorthand -->
240-
<input @keyup.enter="submit">
241+
Using `keyCode` attributes is also permitted:
242+
243+
``` html
244+
<input v-on:keyup.13="submit">
241245
```
242246

243-
Here's the full list of key modifier aliases:
247+
Vue provides aliases for the most commonly used key codes when necessary for legacy browser support:
244248

245249
- `.enter`
246250
- `.tab`
@@ -252,27 +256,15 @@ Here's the full list of key modifier aliases:
252256
- `.left`
253257
- `.right`
254258

259+
<p class="tip">A few keys (`.esc` and all arrow keys) have inconsistent `key` values in IE9, so these built-in aliases should be preferred if you need to support IE9.</p>
260+
255261
You can also [define custom key modifier aliases](../api/#keyCodes) via the global `config.keyCodes` object:
256262

257263
``` js
258264
// enable `v-on:keyup.f1`
259265
Vue.config.keyCodes.f1 = 112
260266
```
261267

262-
### Automatic Key Modifiers
263-
264-
> New in 2.5.0+
265-
266-
You can also directly use any valid key names exposed via [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values) as modifiers by converting them to kebab-case:
267-
268-
``` html
269-
<input @keyup.page-down="onPageDown">
270-
```
271-
272-
In the above example, the handler will only be called if `$event.key === 'PageDown'`.
273-
274-
<p class="tip">A few keys (`.esc` and all arrow keys) have inconsistent `key` values in IE9, their built-in aliases should be preferred if you need to support IE9.</p>
275-
276268
## System Modifier Keys
277269

278270
> New in 2.1.0+

src/v2/guide/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ rollup({
151151
// ...
152152
plugins: [
153153
alias({
154-
'vue': 'vue/dist/vue.esm.js'
154+
'vue': require.resolve('vue/dist/vue.esm.js')
155155
})
156156
]
157157
})

src/v2/guide/reactivity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Since `$nextTick()` returns a promise, you can achieve the same as the above usi
125125

126126
``` js
127127
methods: {
128-
async updateMessage: function () {
128+
updateMessage: async function () {
129129
this.message = 'updated'
130130
console.log(this.$el.textContent) // => 'not updated'
131131
await this.$nextTick()

src/v2/guide/render-function.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ Especially when the template version is so simple in comparison:
480480
</anchored-heading>
481481
```
482482

483-
That's why there's a [Babel plugin](https://github.com/vuejs/babel-plugin-transform-vue-jsx) to use JSX with Vue, getting us back to a syntax that's closer to templates:
483+
That's why there's a [Babel plugin](https://github.com/vuejs/jsx) to use JSX with Vue, getting us back to a syntax that's closer to templates:
484484

485485
``` js
486486
import AnchoredHeading from './AnchoredHeading.vue'
@@ -497,9 +497,9 @@ new Vue({
497497
})
498498
```
499499

500-
<p class="tip">Aliasing `createElement` to `h` is a common convention you'll see in the Vue ecosystem and is actually required for JSX. If `h` is not available in the scope, your app will throw an error.</p>
500+
<p class="tip">Aliasing `createElement` to `h` is a common convention you'll see in the Vue ecosystem and is actually required for JSX. Starting with [version 3.4.0](https://github.com/vuejs/babel-plugin-transform-vue-jsx#h-auto-injection) of the Babel plugin for Vue, we automatically inject `const h = this.$createElement` in any method and getter (not functions or arrow functions), declared in ES2015 syntax that has JSX, so you can drop the `(h)` parameter. With prior versions of the plugin, your app would throw an error if `h` was not available in the scope.</p>
501501

502-
For more on how JSX maps to JavaScript, see the [usage docs](https://github.com/vuejs/babel-plugin-transform-vue-jsx#usage).
502+
For more on how JSX maps to JavaScript, see the [usage docs](https://github.com/vuejs/jsx#installation).
503503

504504
## Functional Components
505505

src/v2/guide/ssr.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ We have created a standalone guide for creating server-rendered Vue applications
1111
## Nuxt.js
1212

1313
Properly configuring all the discussed aspects of a production-ready server-rendered app can be a daunting task. Luckily, there is an excellent community project that aims to make all of this easier: [Nuxt.js](https://nuxtjs.org/). Nuxt.js is a higher-level framework built on top of the Vue ecosystem which provides an extremely streamlined development experience for writing universal Vue applications. Better yet, you can even use it as a static site generator (with pages authored as single-file Vue components)! We highly recommend giving it a try.
14+
15+
## Quasar Framework SSR + PWA
16+
17+
[Quasar Framework](https://quasar-framework.org/) will generate an SSR app (with optional PWA handoff) that leverages its best-in-class build system, sensible configuration and developer extensibility to make designing and building your idea a breeze. With over one hundred specific "Material Design 2.0"-compliant components, you can decide which ones to execute on the server, which are available in the browser - and even manage the `<meta>` tags of your site. Quasar is a node.js and webpack based development environment that supercharges and streamlines rapid development of SPA, PWA, SSR, Electron and Cordova apps - all from one codebase.

0 commit comments

Comments
 (0)