Skip to content

Commit bbb7413

Browse files
committed
doc
1 parent 82f9516 commit bbb7413

33 files changed

+563
-627
lines changed

docs/README.md

Lines changed: 7 additions & 611 deletions
Large diffs are not rendered by default.

docs/_coverpage.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
# This site is in devloping...
2-
3-
# vue-facing-decorators
1+
# vue-facing-decorator
42

53
> Designed for vue 3.
64
75
> Write class components by TypeScript decorator.
86
97
![GitHub](https://img.shields.io/github/license/facing-dev/vue-facing-decorator) ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/facing-dev/vue-facing-decorator/release) ![npm peer dependency version (scoped)](https://img.shields.io/npm/dependency-version/vue-facing-decorator/peer/vue)
108

11-
[GitHub](https://github.com/facing-dev/vue-facing-decorator) [Getting Started](#read-me)
9+
[GitHub](https://github.com/facing-dev/vue-facing-decorator) [Getting Started](#information)

docs/_sidebar.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
- [Quick start](home/quick-start/quick-start.md)
1+
- [Information](README.md)
2+
- [Quick start](quick-start/quick-start.md)
23
- Class component
34
- [Component](class-component/component/component.md)
45
- [Property](class-component/property/property.md)
56
- [Method](class-component/method/method.md)
67
- [Lifecycle hooks](class-component/lifecycle-hook/lifecycle-hook.md)
78
- [Getter](class-component/getter/getter.md)
8-
- [Event](class-component/event/event.md)
9+
- [Event](class-component/event/event.md)
10+
- [Reference](class-component/ref/ref.md)
11+
- [Watcher](class-component/watcher/watcher.md)
12+
- [Injection](class-component/injection/injection.md)
13+
- Inheritance
14+
- [ECMAScript class](inheritance/es-class/es-class.md)
15+
- [Component](inheritance/component/component.md)
16+
- [Complex example](inheritance/complex-example/complex-example.md)

docs/class-component/component/component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ It will be assigned to vue option component before `modifier`.
8080

8181
### modifier
8282

83-
Finally, you can use this function to modify the generated vue option component directly.
83+
Finally, we can use this function to modify the generated vue option component directly.
8484

8585
> This option belongs to `vue-facing-decorator`.
8686

docs/class-component/event/event.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Usage
22

3-
You could define a method that trigger a vue event by `Emit` decorator.
3+
You could define a method which triggers a vue event by `Emit` decorator.
44

5-
The decorator received an optional event name paramater. Event will be triggered with this name and the returned value. If the parameter is omitted, use method's name as event name.
5+
The decorator received an optional event name paramater. Event will be triggered with this name and the method returned value. If the event name parameter is omitted, use method's name by default.
66

77
[](./code-usage.ts ':include :type=code typescript')
88

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
import { Inject, Component, Vue } from 'vue-facing-decorator'
3+
4+
/*
5+
Vue option component
6+
{
7+
inject:{
8+
name:{
9+
default:'default name'
10+
}
11+
}
12+
}
13+
*/
14+
15+
@Component
16+
class MyComponent extends Vue {
17+
@Inject({
18+
default: 'default name'
19+
})
20+
readonly name!: string
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
import { Inject, Component, Vue } from 'vue-facing-decorator'
3+
4+
/*
5+
Vue option component
6+
{
7+
inject:{
8+
nameAlias:{
9+
from:'name'
10+
}
11+
}
12+
}
13+
*/
14+
15+
@Component
16+
class MyComponent extends Vue {
17+
@Inject({
18+
from:'name'
19+
})
20+
readonly nameAlias!: string
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
import { Inject, Component, Vue } from 'vue-facing-decorator'
3+
4+
/*
5+
Vue option component
6+
{
7+
inject:{
8+
name:{}
9+
}
10+
}
11+
*/
12+
13+
@Component
14+
class MyComponent extends Vue {
15+
@Inject
16+
readonly name!: string
17+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Usage
2+
3+
Use `Inject` decorator to define a watcher in vue's `inject`.
4+
5+
[](./code-usage.ts ':include :type=code typescript')
6+
7+
## Options
8+
9+
### from
10+
11+
This is the `from` in vue `inject`.
12+
13+
[](./code-option-from.ts ':include :type=code typescript')
14+
15+
### default
16+
17+
This is the `default` in vue `watch`.
18+
19+
[](./code-option-default.ts ':include :type=code typescript')
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
import { Ref, Component, Vue } from 'vue-facing-decorator'
3+
4+
/*
5+
6+
<template>
7+
<div ref="refEl"></div>
8+
</template>
9+
10+
Vue option component
11+
{
12+
computed:{
13+
refEl(){
14+
return this.refs['refEl']
15+
}
16+
}
17+
}
18+
*/
19+
20+
@Component
21+
class MyComponent extends Vue {
22+
@Ref
23+
readonly refEl!: HTMLDivElement
24+
}

0 commit comments

Comments
 (0)