vue + typescript:Property 'xxx' does not exist on type 'Vue'.
related codes and errors:
how to fix this error:Property xxx does not exist on type 'Vue'
export default Vue.extend({
props: {
menu: {
type: Array,
default: () => []
}
},
name: 'navHeaderMenu',
data() {
return {
hoverIndex: ''
}
},
methods: {
triggerToMousemove(i: number): void {
// if I used this method:
// vscode would shows:Property 'hoverIndex' does not exist on type 'Vue'.
this.houverIndex = i
// vscode error:Property 'test' does not exist no type 'Vue'.
this.ab()
// if I wrote like these:
// vscode no errors
(this as any).houverIndex = i
(this as any).test()
this.$emit('mouseover', i)
},
triggerToMouseout(i: number): void {
(this as any).hoverIndex = ''
this.$emit('mouseout', i)
},
test() {
console.log('test')
},
},
})how to fix this error:Property xxx does not exist on type 'Vue'
No any search results
You already invited:
0 Answers