Within my Vuejs inline template components, we typically register the component in a javascript file and define its template in html.
An example of such a component is shown below:
Vue.component('compare-benefits', {
data() {
// By returning this object, the "this" keyword in methods should reference it
return {
...state,
isLoading: false,
}
},
methods: {
getData() {
// How can I make sure that the "this" keyword here points to the object returned in the data method above?
this.isLoading = true;
}
}
})
If you're not familiar with Vue, essentially what's happening is that Vue will automatically bind the this
keyword in your methods to the object returned from the data() method.
I'm wondering how I can use jsDoc to specify that the this
keyword within this context is referring to that particular object?
EDIT: The main reason for incorporating jsDoc isn't just for documentation purposes but also to enable intellisense and type checking in vscode using @ts-check