第一种:最常用
let a = 1;
function b () {
console.log(2);
}
export default {
a,
b
}
import index from './xxx';
index.a, index.b
第二种
let a = 1;
function b () {
console.log(2);
}
export {
a,
b
}
import {a, b} from './xxx';
//直接用a或者b调用就行
第三种
export let a = 1;
export let b = function() {
console.log(1);
};
import * as index from './xxx'
//index.a, index.b调用