export default and export of use (six)

A: import module for ES6 manner and exposed objects by:

  1. ES6 module import: import module name from 'module identifier'; Import 'represents the path';
  2. And export the export using default ES6 member exposed outwardly;
  3. export default outwardly exposed members may be received by any variable;
  4. In one module, export default outwardly exposed only once
  5. Export default and export may be used simultaneously exposed members in a module;
  6. export: using the export member outwardly exposed, only the form of {} is received, called export demand;
  7. export: export multi-member may be exposed outward, while if the dictation members, when we import does not require the {} may not be defined;
  8. export: the use of export Export Members must be in strict accordance with the export name when to use {} demand acceptance;
  9. export: export exported using the member, if you want to change the name of a custom reception, to be used as aliases;

test.js file:

// Use default export the export and ES6 member exposed outwardly; 
// var info = {
// name: 'ZS',
@ Age: 20 is
//};
// default export info;
Export default { 
    name: 'ZS' , 
    Age: 20 is 
} 
Export var title = 'Little Star' ; 
Export var context = 'ha ha';

main.js file:

import test,{ title as qwer, context} from './test.js';
console.log(test);
console.log(qwer);
console.log(context);

effect:

 

Two: Node Import module exposed objects mode and manner:

  1. In the node: var name = require ( 'module identifiers') into modules;
  2. module exports and exports to expose members;

 

Guess you like

Origin www.cnblogs.com/lubolin/p/10942511.html