-
-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto-import component in <script> when using component in template/javascript #684
Comments
As a note, need to look into how to resolve path aliases... |
+1 |
+1hope import absolute path like |
+1 |
3 similar comments
+1 |
+1 |
+1 |
+1 |
1 similar comment
+1 |
after a long while I reviewed the progress today, and still found auto import via alias not working. However, found a very useful tool, not perfect but enough for auto importing vue components and js variables using alias(remember to use shortcut to import vue components): |
+1 |
+1, moving from webstorm to vscode + vetur, i find this one of the biggest features im missing. |
This is failing again after the last release. Works again by reverting the version to the previous one. |
any update on this? |
@yoyo930021 hi, it doesn’t work, when I don’t use export default, but name the component. |
@danranVm that's not a valid SFC component SFC spec please use Your <template>a = {{ a }}</template>
<script lang="ts">
import {defineComponent} from 'vue'
export const HelloWorld = defineComponent({
setup() {
return {
a: 1,
};
},
});
</script> EDIT: Which will only render Also the compiled component will be: import {defineComponent} from "/@modules/vue.js";
export const HelloWorld = defineComponent({
setup() {
return {
a: 1
};
}
});
const __script = {}
import { render as __render } from "path/HelloWorld.vue?type=template"
__script.render = __render
__script.__hmrId = "path/HelloWorld.vue"
__script.__file = "path\\HelloWorld.vue"
export default __script |
@pikax I see. thank you for your answer. |
Similar to JS/TS's auto import in VS Code: https://code.visualstudio.com/updates/v1_18#_auto-import-for-javascript-and-typescript
The text was updated successfully, but these errors were encountered: