暴露
分别暴露
export let school = ‘杭电’
export function play()
{
console.log(“我会打游戏”)
}
统一暴露
let school = ‘杭电’
function play(){
console.log(“我会打游戏”)
}
export {school,play}
默认暴露
export default {
school:‘hangdian’,
change:function(){
console.log(‘change myself’)
}
}
引入
通用引入
import * as m from ‘{{路径名}}’ 全部存入对象m中
解构赋值形式
import {school,play} from 路径名
简便形式针对于默认暴露
import school from 路径名