Skip to content

Instantly share code, notes, and snippets.

@oshx
Last active October 17, 2019 01:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save oshx/2af9395374be24b7270980adb517ed0e to your computer and use it in GitHub Desktop.
타입스크립트를 사용한 Vue.js 클래스 패턴 컴포넌트 스캐폴드 / Component Scaffold for class pattern Vue.js with TypeScript

타입스크립트를 사용한 Vue.js 클래스 패턴 컴포넌트 스캐폴드

Component Scaffold for class pattern Vue.js with TypeScript

이 문서는 Vue.js v2.5에 해당

This document is for Vue.js v2.5

의존성 vue-property-decorator 추가

Add a dependency vue-property-decorator

vue-property-decorator

npm i -S vue-property-decorator
  • 또는
yarn add vue-property-decorator

Sample.vue in ECMAScript

<template>
  <div></div>
</template>

<script>
import {Component, Vue} from "vue-property-decorator";

export default
@Component({
  // life cycle hooks and components
})
class Sample extends Vue {}
</script>

Sample.vue in TypeScript

<template>
  <div></div>
</template>

<script lang="ts">
import {Component, Vue} from "vue-property-decorator";

@Component<Sample>({
  // life cycle hooks and components
})
export default class Sample extends Vue {}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment