Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created January 24, 2018 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/e81f5f9004570ffafedd1325bbba9fca to your computer and use it in GitHub Desktop.
Save matthieu-D/e81f5f9004570ffafedd1325bbba9fca to your computer and use it in GitHub Desktop.
import Vue from 'vue'
import Component from 'vue-class-component'
// The @Component decorator indicates the class is a Vue component
@Component({
// All component options are allowed in here
template: '<div>{{message}} <button @click="onClick">Click!</button></div>'
})
export default class SimpleTsComponent extends Vue {
// Initial data can be declared as instance properties
message: string = 'Hello!'
// Component methods can be declared as instance methods
onClick (): void {
console.log('TypeScript working!');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment