Skip to content

Instantly share code, notes, and snippets.

@mitchell-garcia
Last active January 16, 2018 01:43
Show Gist options
  • Save mitchell-garcia/58f81eb04f6e33bca7b24ba583e35c19 to your computer and use it in GitHub Desktop.
Save mitchell-garcia/58f81eb04f6e33bca7b24ba583e35c19 to your computer and use it in GitHub Desktop.
Single File Component Example
<script lang="ts">
import Component from "vue-class-component"
import { Prop } from "vue-property-decorator"
type ComplexObjectInterface = {
testProp: string
modelName: number
}
@Component
export default ComponentName extends Component {
@Prop({
type: Object
})
propExample: ComplexObjectInterface
dataExample: string = "This Property Will Be Data"
get computedExample() {
return this.dataExample + this.propExample.testProp + "Computed Property Example";
}
methodExample() {
this.dataExample = "This is being done in a method"
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment