javascript - 如何从命名模块导入中省略 .default
问题描述
我正在努力配置我的导入和导出,以便.default
在我想选择要导出的内容而不是模块时不必使用。
它是如何导出的。
import * as Icon from './components/1_atom/icon/svgicon'
import * as Button from './components/1_atom/button/button'
export { Icon, Button }
export default Icon;
它是如何导入的
import { Button, Icon } from '@philipaarseth/simple-components';
如果我 console.log 按钮,这就是我得到的
有没有办法可以改变我导出模块的方式,这样我就不必使用了Button.default
?
解决方案
感谢 loganfsmyth 的评论:
答案只是改变
import * as Icon from
至
import Icon from
推荐阅读
- postgresql - 在 Spilo 容器上预加载 TimescaleDB
- c# - 从 API 更新应用程序的正确方法是什么?
- angular - 访问 ViewChildren Querylist (Angular) 的第 n 个子项
- reactjs - 嵌套反应导航深度链接与博览会反应原生
- python - 我的条件 GAN 似乎正在经历模式崩溃
- java - 没有键盘输入java
- python - QListView 维护选择并检查所有选择
- javascript - 如何仅从 Date 对象中获取时间?
- r - CVXR 示例 cvxr_kelly-strategy 的扩展不符合 DCP?
- wordpress - 如何隐藏 Wordpress 中特定角色的“提交审核”按钮?