ES6模块化基本使用

1.新建一个info.js文件:如下:

export const name="李白";

export const age=18;

export const height="1.88cm";

2、在另外一个main.js文件中导入使用:

import { name,age,height} from './info.js';

console.log(name, age, height);

 

posted @ 2020-11-09 16:43  银河游鱼  阅读(183)  评论(0编辑  收藏  举报