1. 函数封装
const onl oadend1 = (e: any, a: any) => {const { graph } = FlowGraph
const reader = new FileReader(); const fileList = fileRef1.value.files // 这个就是选中的文件流 if (!fileList.length) return reader.readAsText(fileList[0], "UTF-8"); reader.onload = function (event: any) { console.log(event.target.result) // 这个就是文件内容 graph.fromJSON(JSON.parse(event.target.result)) } }
标签:文件,const,读取,展示,前端,fileList,event,reader,any From: https://www.cnblogs.com/zhulongxu/p/17550414.html