ES6模块规范
en.js
let dd = { tt: '123' }; let conts = { context: '啊就好啦是领导' }; export default { dd, conts };
zh.js
export const m = { music: '网易云音乐', findMusic: '发现音乐', myMusic: '我的音乐', friend: '朋友', musician: '音乐人', download: '下载客户端' };
main.js
import * as zh from './config/zh'; import en from './config/en'; console.log('zh', zh); console.log('en', en);
总结:
import * as xxx from ‘xxx’: 会将若干export导出的内容组合成一个对象返回;
import xxx from ‘xxx’:(export default Din)只会导出这个默认的对象作为一个对象