【ES2015 import】
The import statement is used to import functions, objects or primitives that have been exported from an external module, another script, etc.
用于导出已经声明为export的function、object。
注意不存在import * from ‘module-name‘的用法,只能是import * as name from ‘module-name‘。
注意导入export default,应当使用 import name from ‘module-name‘
注意导入export,应该加上{},如import {name} from ‘module-name‘
【ES2015 export】
The export statement is used to export functions, objects or primitives from a given file (or module).
参考:
1、https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
2、https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
时间: 2024-12-13 17:44:47