Skip to content

Instantly share code, notes, and snippets.

@lakshyabatman
Last active April 22, 2020 03:13
Show Gist options
  • Save lakshyabatman/d848630110bc958e77f76e1935ebd7c8 to your computer and use it in GitHub Desktop.
Save lakshyabatman/d848630110bc958e77f76e1935ebd7c8 to your computer and use it in GitHub Desktop.
Test component using Vue + Typescript
<template>
<div>
<p>Hi this is test template</p>
<p>{myComputedFunction}</p>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import { Component, Prop ,Emit } from 'vue-property-decorator';
import AnotherComponent from './another-component.vue'
@Component({
components: {
'another-one': AnotherComponent,
},
name:'Test component'
})
export default class TestComponent extends Vue {
@Prop({default: 'default value'})
myProp : string | { isObject : true } | any
mounted() {
console.log("Hi this component is mounted now!");
}
get myComputedFunction () {
return 'I love'+ 'Vue';
}
@Emit('emitterFunction')
onClick() {
console.log("Emit function");
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment