1.代码
1.1 t2.js
var year = "test";
export { year };
1.2 t1.js
import { year } from './t2.js'
alert(year);
1.3 t.html
<script type="module" src="./t1.js"></script>
2.运行结果

1.代码
1.1 t2.js
var year = "test";
export { year };
1.2 t1.js
import { year } from './t2.js'
alert(year);
1.3 t.html
<script type="module" src="./t1.js"></script>
2.运行结果

1138
2511

被折叠的 条评论
为什么被折叠?