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
[Vue Class Components](https://class-component.vuejs.org/) offers an alternative class-style syntax for Vue components and it integrates well with TypeScript.
87
+
### Class Components
88
+
[Vue Class Components](https://class-component.vuejs.org/) offers an alternative class-style syntax for Vue components which integrates well with TypeScript.
89
89
90
90
To have consistent support for decorators in your Vue components, it's also recomended to install [vue-property-decorator](https://github.com/kaorun343/vue-property-decorator).
91
91
92
92
93
-
To get started with both libraries, in your existing Vue project, run:
93
+
To get started with both libraries in your existing Vue project, run:
94
94
```
95
95
npm install --save vue-class-component
96
96
npm install --save vue-property-decorator
97
97
```
98
98
99
-
You only need to import `vue-property-decorator` into your `.vue`file as it extends off`vue-class-component`.
99
+
You only need to import `vue-property-decorator` into your `.vue` file as it extends `vue-class-component`.
100
100
101
-
You can now write components like this:
101
+
You can now write TS in your components like this:
102
102
103
103
```vue
104
104
<template>
@@ -110,10 +110,9 @@ You can now write components like this:
110
110
</div>
111
111
</template>
112
112
113
-
<script>
113
+
<script lang="ts">
114
114
import { Vue, Component } from "vue-property-decorator";
- Views on Vue podcast - https://devchat.tv/views-on-vue/vov-076-typescript-tell-all-with-jack-koppa/
151
-
- Focuses quite a lot on class components and third party libs like vue-property-decorator https://blog.logrocket.com/how-to-write-a-vue-js-app-completely-in-typescript/
200
+
- Focuses a lot on class components and vue-property-decorator -https://blog.logrocket.com/how-to-write-a-vue-js-app-completely-in-typescript/
0 commit comments