模块化-import语法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模块化-import语法</title>

</head>
<body>


<script type="module">
    //1通用导入方式
    //import * as m1 from './m1.js';

    //2解构赋值方式
    //import {name,add} from './m1.js'; //export, export{}
    //import {name as name1, add} from './m1.js'; //export , export{}
    //import {default as m3} from './m1.js'; //export default
    //console.log(m3);
    //console.log(m3.add(2,3));

    // 3 简便形式 适用 export default
    import m3 from './m1.js';
    console.log(m3);
    console.log(m3.add(2,3));

</script>
</body>
</html>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2021-10-16
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2022-03-03
猜你喜欢
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
相关资源
相似解决方案