Component Data Interfaces for Vue 2? #1016
-
It's mentioned that we have these here: #418 However, I can't seem to get these working with Vue 2. Do we not get auto-completion & docs with Vue 2 & volar? Alternatively, for Vue 2, we already have JSON bits that define the APIs we all have. Any reason that cannot be supported for compatibility? The example here: https://github.com/johnsoncodehk/volar/tree/master/extensions/vscode-vue-language-features Doesn't seem to work in Vue2? // components.d.ts
declare module '@vue/runtime-core' {
export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
export {} I still get no autocomplete or API info for router links or views. Are there more explicit exmaples of defining components this way that we can use? Especially for component libraries that are not using typescript? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Because vue-router 3(vue 2) has no types for it. It only works in vue-router 4(vue 3). |
Beta Was this translation helpful? Give feedback.
-
We already supported language service plugin: #1027 You can implement most of vetur specific features with plugins such as json base component intellisense, customizable scaffold snippets, ESLint... I still have a lot of backlog on volar, so I don't plan to do it. If you want to do it, you can contact me on the discord server and I'm happy to help. |
Beta Was this translation helpful? Give feedback.
Because vue-router 3(vue 2) has no types for it. It only works in vue-router 4(vue 3).