<body>
<button>选择文件夹</button>
<input type="file">
<script>
let button = document.querySelector('button')
button.onclick = async function () {
try {
const file = await showDirectoryPicker()
console.log(file, "file");
} catch {
}
}
</script>
</body>