JS模块

Posted tujw

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JS模块相关的知识,希望对你有一定的参考价值。

       <script type="module">
		import aaa, c, b from ‘./js/index.js‘   // aaa as a 取别名
		console.log(aaas, b, c);
                
                // 也可以
                import * as obj from ‘./js/index.js‘
		console.log(obj.aaa);

	</script>

       // ./js/index.js

	var a = 10;
	var b = 20;
	var c = -30;

	export 
		a, // a as aa 取别名
		b,
		c
	        

  

以上是关于JS模块的主要内容,如果未能解决你的问题,请参考以下文章