赞
踩
- <template>
- <input id="upload" type="file" />
- </template>
- <script>
- import BMF from "browser-md5-file"; //npm i browser-md5-file -S
- export default {
- mounted() {
- const el = document.getElementById("upload");
- const bmf = new BMF();
-
- el.addEventListener("change", handle, false);
-
- function handle(e) {
- const file = e.target.files[0];
- bmf.md5(
- file,
- (err, md5) => {
- console.log("err:", err);
- console.log("md5 string:", md5);
- },
- (progress) => {
- console.log("progress number:", progress);
- }
- );
- }
- },
- };
- </script>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。