来自< module>吗?在ES6中导入< class>`语法? [英] is there `from <module> import <class>` syntax in ES6?

查看:56
本文介绍了来自< module>吗?在ES6中导入< class>`语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如在ES6中导入

从模块导入MyClass;

问题是intellisense不会像python一样出现。在python中,例如:

The problem is intellisense doesnt pick up like in python. In python it would be for example:

from mo ,这里的intellisense已经开始工作并愿意提供完成的 module

from mo and here intellisense would already start working and would offer to complete module

来自模块import M ,这里已经提供了所有以M开头的类。

from module import M and here would already offer all the classes starting with M.

代替模块中的 import类,可以通过模块import类来实现
在ES6中?

Instead of import Class from module is there a way to do from module import Class in ES6?

推荐答案

这取决于IDE。我在VS Code中发现,方法 Bergi 说的效果很好,从 import {}开始从Module 开始。同样,这取决于IDE。当模块仅导出一件事时,您负责该变量的命名。

It is dependent upon the IDE. I have found in VS Code that the method Bergi said works quite well, starting with import {} from Module and going from there. Again, this is dependent upon the IDE. When a module only exports one thing, you are responsible for the naming of that variable.

快乐编码!

这篇关于来自< module>吗?在ES6中导入< class>`语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆