You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-14Lines changed: 12 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,22 +2,24 @@
2
2
3
3
> Experimental ES2016/TypeScript decorator for class-style Vue components.
4
4
5
-
### Example Usage with Babel stage=0:
5
+
### Usage
6
+
7
+
Required: Babel with stage 1 transforms (for [decorators](https://github.com/wycats/javascript-decorators/blob/master/README.md)).
6
8
7
9
Note:
8
10
9
11
1.`data`, `el` and all Vue lifecycle hooks can be directly declared as class member methods, but you cannot invoke them on the instance itself. When declaring custom methods, you should avoid these reserved names.
10
12
11
-
2. For all other options, declare them as **static properties**.
13
+
2. For all other options, pass them to the decorator function.
12
14
13
15
```js
14
-
importVueComponentfrom'vue-class-component'
15
-
16
-
@VueComponent
17
-
exportdefaultclassComponent {
16
+
importComponentfrom'vue-class-component'
18
17
19
-
// template
20
-
static template =`
18
+
@Component({
19
+
props: {
20
+
propMessage:String
21
+
},
22
+
template:`
21
23
<div>
22
24
<input v-model="msg">
23
25
<p>prop: {{propMessage}}</p>
@@ -26,12 +28,8 @@ export default class Component {
0 commit comments