Skip to content

Instantly share code, notes, and snippets.

@lakshyabatman
Last active April 22, 2020 03:12
Show Gist options
  • Save lakshyabatman/f7f173ae2406d333a5d97854d1306948 to your computer and use it in GitHub Desktop.
Save lakshyabatman/f7f173ae2406d333a5d97854d1306948 to your computer and use it in GitHub Desktop.
Test component with child components
<template>
<div>
<p>Hi this is test template</p>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import { Component, Prop} from 'vue-property-decorator';
import AnotherComponent from './another-component.vue'
@Component({
components: {
// We've added custom name for the component, else it can be simply adding component here
'another-one': AnotherComponent,
},
name:'Test component'
})
export default class TestComponent extends Vue {
//In typescript you have to declare type of a variable and | means or here.
@Prop({default: 'default value'})
myProp : string | { isObject : true } | any
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment