1.index

<body>
    <!-- 模块化导入 import{导入的变量名或者函数名}、
            导出 export{导出的变量名或者函数名} from "./a.js" 如下-->
    <!-- 导出:export {
                flag,
                sum,
                uname
            } -->
    <!-- //  导入:import { flag, sum } from "./a.js"; -->
    <!--在 script标签里面写 type="module" 代表使用模块化开发 有单独的作用域  命名一样也不会冲突-->
    <script src="ES6的导出方式.js" type="module"></script>
    <script src="b.js" type="module"></script>
    <script src="ES6的导入方式.js" type="module"></script>
</body>
原文地址:https://www.cnblogs.com/yanglaxue/p/14206854.html