如何在VUE文件中订购导入?

发布于 2025-01-28 05:02:06 字数 144 浏览 1 评论 0原文

我正在使用更漂亮的,但它没有格式化导入的顺序。

例如,当使用in in in vs code时,我可以按任何顺序导入东西,但是GOFMT总是以正确的顺序对其进行重新排序 - 我猜这是VS代码官方GO扩展的一部分。

如何在VS代码中实现类似的东西?

I am using Prettier but it doesn't format the order of imports.

For example, when using Go in VS Code, I can import stuff in whatever order but Gofmt will always reorder it in the right order - I guess it is part of the official Go extension for VS Code.

How to achieve something like that in Vue in VS Code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦太阳 2025-02-04 05:02:06

它看起来像 volar> volar 导入),无论如何,这是VSCODE和VUE3的推荐扩展。 Vetur主要用于Vue2。

这可以用 eslint Too 。这是与VUE + JS有关的任何官方衬里。

由于VUE方法 +组件等自动进来,人们在VUE3中往往没有很多进口。总体上可能有更多的魔术,如 unplugin软件包

You could use this extension I guess: https://marketplace.visualstudio.com/items ?itemName = amatiasq.sort-imports

It looks like Volar supports this feature (Command palette + Organize Imports), it's the recommended extensions for VScode and Vue3 anyway. Vetur being for Vue2 mainly.

This can be done with Eslint too. Which is the official linter for anything related to Vue + JS.

People tend to not have a lot of imports overall in Vue3, thanks to auto-imports of Vue methods + components etc. There is maybe more magic overall, as shown by the unplugin packages.

You could use this extension I guess: https://marketplace.visualstudio.com/items?itemName=amatiasq.sort-imports

万劫不复 2025-02-04 05:02:06

还有一个漂亮的插件,该插件支持VUE文件中的格式化导入: htttps://github.com /ianvs/Prettier-Plugin-Sort-Imports (我是维护者)。

There's also a prettier plugin that supports formatting imports in vue files: https://github.com/IanVS/prettier-plugin-sort-imports (I'm the maintainer).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文