1

ES6模块化引入

//a.js   导出的关键字  export
    export let str = "laowang";
    export function add(a,b){
    return a + b ;
    }


// b.js   导入的关键字  import
// (内容)被导入的属性或者方法

import{str,add} from "./a.js"; console.log(str); console.log(add); //b.html <script src = "b.js" type = module> </script>

 

posted @ 2020-11-11 17:57  small_zhouzhou  阅读(148)  评论(0)    收藏  举报
TOP