Skip to content

Commit 320fad3

Browse files
committed
Improve Components documentation
1 parent 7ba9b2e commit 320fad3

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

docs-source/book/SUMMARY.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@
1717
* [List Rendering](essential/list.md)
1818
* [Event Handling](essential/events.md)
1919
* [Form Input Bindings](essential/forms.md)
20-
* [Components](essential/components.md)
21-
* [What are Components?](essential/components.md#what-are-components)
20+
* [Composing with Components](essential/components.md)
2221
* [Using Components](essential/components.md#using-components)
2322
* [Props](essential/components.md#props)
23+
* [Non-Prop Attributes](essential/components.md#non-prop-attributes)
24+
* [Custom Events](essential/components.md#custom-events)
2425
* [Content Distribution with Slots](essential/components.md#content-distribution)
2526
* [Dynamic Components](essential/components.md#dynamic-components)
2627
* [Dependency Injection](essential/dependency-injection.md)

docs-source/book/essential/components.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# Components
1+
# Composing with Components
22

33
!INCLUDE "../dependencies.md"
44

55
*This page comes from the [official Vue.js documentation](https://vuejs.org/v2/guide/components.html) and has been adapted for Vue GWT.*
66

7-
## What are Components? {#what-are-components}
7+
## Using Components {#using-components}
8+
9+
### What are Components? {#what-are-components}
810

911
Components are one of the most powerful features of Vue.
1012
They help you extend basic HTML elements to encapsulate reusable code.
1113
At a high level, components are custom elements that Vue's compiler attaches behavior to.
1214
In some cases, they may also appear as a native HTML element extended with the special `is` attribute.
1315

14-
## Using Components {#using-components}
15-
1616
### Registration
1717

1818
We already saw how to define a Component in Vue GWT.
@@ -173,8 +173,10 @@ public class SharedDataModelComponent extends VueComponent {
173173
We then instantiate 3 of those Components:
174174

175175
{% raw %}
176-
<div class="example-container" data-name="simpleLinkComponent">
177-
<span id="simpleLinkComponent"></span>
176+
<div class="example-container" data-name="sharedDataModelComponent">
177+
<span id="sharedDataModelComponent1"></span>
178+
<span id="sharedDataModelComponent2"></span>
179+
<span id="sharedDataModelComponent3"></span>
178180
</div>
179181
{% endraw %}
180182

@@ -290,7 +292,7 @@ There are usually two cases where it's tempting to mutate a prop:
290292

291293
The proper answer to these use cases are:
292294

293-
1. Define a local data property that uses the prop's initial value as its initial value:
295+
<span>1.</span> Define a local data property that uses the prop's initial value as its initial value:
294296

295297
```java
296298
@Component
@@ -308,7 +310,7 @@ public class MyComponent extends VueComponent implements HasCreated {
308310
}
309311
```
310312

311-
2. Define a computed property that is computed from the prop's value:
313+
<span>2.</span> Define a computed property that is computed from the prop's value:
312314

313315
```java
314316
@Component
@@ -363,7 +365,7 @@ public class PropDefaultValueComponent extends VueComponent {
363365

364366
Beware that in this method you don't have access to your Instance (`this`).
365367

366-
## Non-Prop Attributes
368+
## Non-Prop Attributes {#non-prop-attributes}
367369

368370
A non-prop attribute is an attribute that is passed to a component, but does not have a corresponding prop defined.
369371

@@ -405,7 +407,7 @@ For most attributes, the value provided to the component will replace the value
405407
So for example, passing `type="large"` will replace `type="date"` and probably break it!
406408
Fortunately, the `class` and `style` attributes are a little smarter, so both values are merged, making the final value: `form-control date-picker-theme-dark`.
407409

408-
## Custom Events
410+
## Custom Events {#custom-events}
409411

410412
We have learned that the parent can pass data down to the child using props, but how do we communicate back to the parent when something happens?
411413
This is where Vue's custom event system comes in.

docs-source/book/introduction/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,7 @@ public class RootGwtApp implements EntryPoint {
513513
}
514514
```
515515

516-
To understand more in depth how the Observation works, and avoid pitfalls keep reading **[the Vue Instance](../essential/the-vue-instance.md)**.
516+
It is **strongly recommended** to read the whole [Essentials section](../essential/the-vue-instance.md) even if skimming through it.
517+
It will teach you everything you need to know to make full use of the framework.
518+
519+
You can then check some specific topics like [Unit Testing](../tooling/unit-testing.md), [Custom Element (Web Component) support](../advanced/custom-elements.md) or [Routing](../scaling-up/routing.md).

0 commit comments

Comments
 (0)