创建javascript模块以从模块中导出函数、对象或原语值时,使用export语句,以便其他程序可以使用import语句。
export { name1, name2, …, nameN }; export { variable1 as name1, variable2 as name2, …, nameN }; export let name1, name2, …, nameN; // also var, const export let name1 = …, name2 = …, …, nameN; // also var, const export function FunctionName(){...} export class ClassName {...} export default expression; export default function (…) { … } // also class, function* export default function name1(…) { … } // also class, function* export { name1 as default, … }; export * from …; export { name1, name2, …, nameN } from …; export { import1 as name1, import2 as name2, …, nameN } from …; export { default } from …;
来源:https://lufeng.info/note/84
原文地址:https://www.cnblogs.com/Sunshine-boy/p/11047058.html
时间: 2024-10-08 12:08:39