【问题标题】:Import all in ES6, but not inside an object [duplicate]在 ES6 中导入所有内容,但不在对象内部 [重复]
【发布时间】:2016-11-12 14:03:06
【问题描述】:

有没有反正不写这个:

import {replace_in_mtstr, tot_width, rationalize, eval_expression, ascii_to_latex, latex_to_ascii, getIndicesOf, cleanIndices, change_sign, exponentiate, multiply_grouped_nodes, flip_fraction, add_brackets, are_of_type, any_of_type, have_same_ancestors, have_same_type, have_same_text, have_single_factor, have_same_denom, are_same_terms, get_prev, get_next, get_all_next, has_op, parse_mtstr, parse_poly, prepare} from "./functions";

在 ES6 中?这些都是不同文件中的所有导出函数。我知道的关闭是import * as object from 'file';。但是,我希望这些函数直接可用,而不是在对象内部。这在 ES6 中可行吗?

【问题讨论】:

  • 不可能……另请参阅here 以及那里链接的问题。
  • 不可能。您可以执行 import functions from "./functions"; 并从 functions 对象访问所有这些导出的函数。
  • 好的,然后:P。谢谢你告诉我。

标签: import ecmascript-6


【解决方案1】:

如 cmets 所示,这是不可能的。

【讨论】:

    猜你喜欢
    • 2016-12-04
    • 2018-04-05
    • 2012-02-29
    • 2014-01-17
    • 1970-01-01
    • 2011-01-13
    • 2015-08-06
    • 2013-07-31
    相关资源
    最近更新 更多