Skip to content

Instantly share code, notes, and snippets.

@tqwewe
Created December 22, 2018 09:57
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 tqwewe/4ad6bd2e7cd1a78e164c8d9b6d4230b1 to your computer and use it in GitHub Desktop.
Save tqwewe/4ad6bd2e7cd1a78e164c8d9b6d4230b1 to your computer and use it in GitHub Desktop.
Vue Typescript Component with all properties sorted to vue spec
import { Vue, Component, Model, Prop, Watch } from 'vue-property-decorator'
@Component({
delimiters: ['{{', '}}'],
comments: false,
components: null,
directives: null,
filters: null,
inheritAttrs: true,
})
export default class RouletteBar extends Vue {
// Interface
@Model('change', { type: Boolean }) checked!: boolean
@Prop(Number) propA!: number
// Local State
dataA = 'foo'
get computedA() {
return 'foo'
}
// Events
@Watch('child')
onChildChanged(newValue: string, oldValue: string) { }
beforeCreate() { }
created() { }
beforeMount() { }
mounted() { }
beforeUpdate() { }
updated() { }
activated() { }
deactivated() { }
beforeDestroy() { }
destroyed() { }
// Non-Reactive Properties
methodA() { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment