Angular 8:导入类的语法不同

lak*_*ate 2 angular

导入angular的两种语法之间有什么不同:

import partition from 'lodash/fp/partition';
import { partition } from 'lodash/fp/partition';
Run Code Online (Sandbox Code Playgroud)

第一个在工作,但其他人不在为我工作。

谢谢

Yev*_*iuk 7

第一个用于导入标记为default

// lodash/fp/partiotion

export const a = 5;
export const b = 'b';
export default {key: 'value'}; // only this line will be imported using the first syntax

Run Code Online (Sandbox Code Playgroud)

第二个允许您指定要导入的内容:

// lodash/fp/partiotion

export const a = 5;
export const b = 7;
export const partition = () => {}; // you are directly importing only this line
Run Code Online (Sandbox Code Playgroud)