gpt4 book ai didi

javascript - export * as bar VS export { 默认为 bar }

转载 作者:行者123 更新时间:2023-12-05 00:38:23 25 4
gpt4 key购买 nike

之间有什么区别

export * as bar from 'foo'

export { default as bar } from 'foo'

在我的特殊情况下,我尝试了以下两种方法,它们都有效,想知道它们之间的潜在差异。
// echarts v5.0.0
export * as ECharts from 'echarts/lib/echarts.js'
export { default as ECharts } from 'echarts/lib/echarts.js'
babel.config.js
module.exports = {
// "@vue/cli-plugin-babel": "~4.5.0",
presets: ['@vue/cli-plugin-babel/preset'],
}

最佳答案

这个导出所有命名导出和默认导出 来自 foobar :

export * as bar from 'foo'
这个 只导出默认导出来自 foobar :
export { default as bar } from 'foo'

关于javascript - export * as bar VS export { 默认为 bar },我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65572130/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com