Skip to content

Commit 6d6decb

Browse files
authored
Merge pull request #39 from vuejs/master
update
2 parents 5856735 + e0979e1 commit 6d6decb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/guide/comparison.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ That said, it would probably make a better comparison between Vue core and Ember
294294

295295
- Vue provides unobtrusive reactivity on plain JavaScript objects and fully automatic computed properties. In Ember, you need to wrap everything in Ember Objects and manually declare dependencies for computed properties.
296296

297-
- Vue's template syntax harnesses the full power of JavaScript expressions, while Handlebars' expression and helper syntax is quite limited in comparison.
297+
- Vue's template syntax harnesses the full power of JavaScript expressions, while Handlebars' expression and helper syntax is intentionally quite limited in comparison.
298298

299299
- Performance-wise, Vue outperforms Ember by a fair margin, even after the latest Glimmer engine update in Ember 2.0. Vue automatically batches updates, while in Ember you need to manually manage run loops in performance-critical situations.
300300

src/guide/migration.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,9 @@ Vue.config.keyCodes.f1 = 112
750750

751751
The problem is event flows that depend on a component's tree structure can be hard to reason about and very brittle when the tree becomes large. It simply doesn't scale well and we don't want to set you up for pain later. `$dispatch` and `$broadcast` also do not solve communication between sibling components.
752752

753-
For the simplest possible upgrade from `$dispatch` and `$broadcast`, you can use a centralized event hub that allows components to communicate no matter where they are in the component tree. Because Vue instances implement an event emitter interface, you can actually use an empty Vue instance for this purpose.
753+
One of the most common uses for these methods is to communicate between a parent and its direct children. In these cases, you can actually [listen to an `$emit` from a child with `v-on`](http://vuejs.org/guide/components.html#Form-Input-Components-using-Custom-Events). This allows you to keep the convenience of events with added explicitness.
754+
755+
However, when communicating between distant descendants/ancestors, `$emit` won't help you. Instead, the simplest possible upgrade would be to use a centralized event hub. This has the added benefit of allowing you to communicate between components no matter where they are in the component tree - even between siblings! Because Vue instances implement an event emitter interface, you can actually use an empty Vue instance for this purpose.
754756

755757
For example, let's say we have a todo app structured like this:
756758

src/guide/render-function.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,22 @@ render: function (createElement) {
266266

267267
## JSX
268268

269-
If you're writing a lot of `render` functions, it might feel painful that we're using 14 lines above in place of this much simpler and arguably more readable template:
269+
If you're writing a lot of `render` functions, it might feel painful to write something like this:
270+
271+
``` js
272+
createElement(
273+
'anchored-heading', {
274+
props: {
275+
level: 1
276+
}
277+
}, [
278+
createElement('span', 'Hello'),
279+
' world!'
280+
]
281+
)
282+
```
283+
284+
Especially when the template version is so simple in comparison:
270285

271286
``` html
272287
<anchored-heading :level="1">

0 commit comments

Comments
 (0)