Answer the question
In order to leave comments, you need to log in
How to make friends dynamic properties in data in Vue and TypeScript?
Goodnight.
Faced a problem when connecting Vue and TS. There is a simple component:
import { Component, Vue } from 'vue-property-decorator';
import DataTable from '@/components/data-table/DataTable.vue';
@Component({
name: 'product-list',
components: {
DataTable
}
})
export default class ProductList extends Vue {
data() {
return {
config: {}
}
},
created() {
this.config = {} // Error: Property 'config' does not exist on type 'ProductList'.
}
}
Answer the question
In order to leave comments, you need to log in
The solution is not to use the data decorator, instead use class properties.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question