Html
通过 <script type="text/javascript">
可以导入 js
包,我们也可以通过 <script type="module">
导入 NPM
包。
使用示例
以github/hotkey
包导入为例:
<script type="module">
import {install} from '/js/github-hotkey/index.esm.js'
// Install all the hotkeys on the page
for (const el of document.querySelectorAll('[data-hotkey]')) {
install(el)
}
</script>