Answer the question
In order to leave comments, you need to log in
What is the @Component component type for?
An example is taken here
What gives if we specify the type of the component?
It works without it, so why then?
Answer the question
In order to leave comments, you need to log in
In this particular case, nothing. However, this generic is used to infer types within the object passed to @Component.
@Component({
methods: {
getd(){
alert(this.messages) // Property "mesages" does note exist on type Vue
}
}
})
export default class Home extends Vue {
messages: string
}
@Component<Home>({
methods: {
getd(){
alert(this.messages) // ok
}
}
})
export default class Home extends Vue {
messages: string
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question