Vetur: Modify the scaffold snippet for TypeScript

Created on 24 Jan 2018  路  5Comments  路  Source: vuejs/vetur

I think it's more useful to change it to the way components should be defined in Vue 2.5.0+ (link):

import Vue from 'vue'

export default Vue.extend({

})

Most helpful comment

I think so.
Though pretty many TS users actually use vue-class-component rather than vanilla Vue.

Maybe we can change scaffold in future if Vue officially support native class syntax.

All 5 comments

I think so.
Though pretty many TS users actually use vue-class-component rather than vanilla Vue.

Maybe we can change scaffold in future if Vue officially support native class syntax.

Fair enough. Could also have two snippets:

  • script with TypeScript
  • script with TypeScript (class component)

is there anyway for us to have our own ?

we use

<template>

</template>

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

@Component({
  components: {},
})
export default class <filename> extends Vue {
}
</script>

and I have no idea how I set it to do that rather than Vue.extends

Was this page helpful?
0 / 5 - 0 ratings