es6 语法 (模块化)
//export export let A=123; //导出 //导出函数 export function test(){ console.log('test'); } //导出类 export class Hello{ test(){ console.log('class'); } } 引用: 模块化 17 import {A,test,Hello} from './class/lesson17.js'; 导入所有内容 import * as lesson from './class/lesson17'; console.log(A,test,Hello); //123 ƒ test() { console.log('test'); } ƒ Hello() { _classCallCheck(this, Hello); } 第二种(提倡) //提倡的方式 let A=123; let test=function(){ console.log('test'); } class Hello{ test(){ console.log('class'); } } //从这里导入 export default { A, test, Hello } 引用:
// import Lesson17 from './class/lesson17';
// console.log(Lesson17.A); //123