Currently, I am working with Vue 3 and TypeScript. In the Setup
function, I have defined some states like this:
export default defineComponent({
setup() {
const isLoadingSendData = ref(false)
return { isLoadingSendData }
},
methods: {
disableBtn(): boolean {
// When using Webstorm, I encountered an error: TS2339: Property 'isLoadingSendData' doesn't exist
// on type 'disableBtn(): boolean'
if(this.isLoadingSendData) {
return // do something
}
return // do something
}
}
})
This is just one example of a particular scenario. The red error under this.isLoadingSendData
in my IDE is confusing me. Can anyone provide insights on why this error occurs?