目录
JS手写
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<button onclick="selectFile('xlsx',data)">点击我上传文件</button>
</body>
<script>
//调用系统文件
function selectFile(access, callBack) {
const input = document.createElement("input");
// type为file文件类型
input.type = "file";
input.accept = `${access}`;
input.click();
input.onchange = () => {
if (input.files) {
const file = input.files[0];