Skip to content

Commit 9374270

Browse files
committed
component option methods
1 parent a41aa9b commit 9374270

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

changelog/v3.0.3.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Features
2+
3+
Register methods in `@Component`.
4+
5+
```
6+
@Component({
7+
methods:{
8+
foo(){
9+
10+
}
11+
}
12+
})
13+
```
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
import { Component, Vue, toNative } from 'vue-facing-decorator'
3+
4+
/*
5+
Vue options component
6+
{
7+
methods:{
8+
foo(){
9+
10+
}
11+
}
12+
}
13+
*/
14+
15+
@Component({
16+
methods: {
17+
foo() {
18+
19+
}
20+
}
21+
})
22+
class MyComponent extends Vue {
23+
24+
}
25+
26+
export default toNative(MyComponent)

docs/en/class-component/component/component.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ This is the `mixins` in vue options API. It only accepts native vue component(if
7878

7979
[](./code-option-mixins.ts ':include :type=code typescript')
8080

81+
82+
### methods
83+
84+
Methods in this field will be exposed to the component.
85+
86+
[](./code-option-methods.ts ':include :type=code typescript')
87+
8188
### options
8289

8390
It will be assigned to vue options API before `modifier`.

docs/zh-cn/class-component/component/component.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878

7979
[](../../../en/class-component/component/code-option-mixins.ts ':include :type=code typescript')
8080

81+
### methods
82+
83+
会被合并进vue option api中的`methods`
84+
85+
[](../../../en/class-component/component/code-option-methods.ts ':include :type=code typescript')
86+
8187
### options
8288

8389
其中的数据会在`modifier`执行前被赋值到vue option组件上。

0 commit comments

Comments
 (0)