Chrome Module
Chrome 61 支持 script(type=’module’) 了!
- defer & async
- demo
Defer & Async
- defer 是渲染完执行
- async 是下载后执行
Demo
html
<script type='module'>
import { sayHello } from './utils.js'
sayHello();
</script>
utils.js
export const sayHello = () => {
console.log('hello');
alert('hello');
};
Comments
Leave a comment