[Vuejs]-Missing Property of this in Vue component

1👍

The Vue CLI docs state:

To let TypeScript properly infer types inside Vue component options, you need to define components with Vue.component or Vue.extend

So, it should look similar to this:

<script lang="ts">
import Vue from 'vue';

export default Vue.extend({
  data() {
    return {
      title: ''
    }
  },
  methods: {
    submitData() {
      console.log(this.title)
    }
  }
})
</script>
👤tony19

Leave a comment