💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 1.第一种 `common.js` ~~~ export var a =10; ~~~ `index.js` ~~~ import {a} from "./common" ~~~ ### 2.第二种 `common.js` ~~~ var a =10; var b = 20; export { a, b } ~~~ `index.js` ~~~ import {a,b} from "./common" ~~~ ### 3.第三种引 `common.js` ~~~ var a =10; var b = 20; export default{ a, b } ~~~ > 一个模块只能有一个export default `index.js` ~~~ import common from "./common" console.log(common.a); console.log(common.b); ~~~ ## 4.第四种 common.js ``` function getData(){ console.log("data") } var a= 10; export { getData, a } ``` index.js ``` import {a,getData as get} from './common.js'; ```