import

Baseline Widely available *

This feature is well established and works across many devices and browser versions. It’s been available across browsers since May 2018.

* Some parts of this feature may have varying levels of support.

静态 import 声明用于导入由另一个模块导出的只读动态(live)绑定。导入的绑定被称为动态绑定,因为它们会由导出绑定的模块更新,但导入模块不能重新赋值。

要在源文件中使用 import 声明,该文件必须被运行时解释为模块。在 HTML 中,这可以通过在