2019.2 VueJS unsing "inject" in component needs autocompletion
I am defining my Axios data services in a service file, which I am then registering in main.js and adding to my components using the VueJS inject https://vuejs.org/v2/api/#provide-inject
However, WebStorm does not does not recognise the injected items for autocompletion, nor does it recognise the methods on the injected Class
请先登录再写评论。
please can you provide code snippets that show up the issue?
main.js
import { DataService } from './dataService'
new Vue({
render: h => h(App),
provide () {
return {
eventBus: new Vue()
restData: new DataService(this.eventBus)
}
}
}).$mount('#app')
Display.vue
// ...
methods: {// Most of the component omitted.
async deleteProduct (product) {await this.restData.deleteProduct(product) // no suggestions for restData, deleteProduct is however offered as a completion once restData is manually
},
},
Does that all make sense?
Thanks!
Submitted to developers as https://youtrack.jetbrains.com/issue/WEB-40356, please follow it for updates