Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何显示BLOB的内容_Javascript_Reactjs - Fatal编程技术网

Javascript 如何显示BLOB的内容

Javascript 如何显示BLOB的内容,javascript,reactjs,Javascript,Reactjs,在该页面中,用户显示一个包含三列的表,一列用于tipo_esame(string),一列用于data_esame(string),一列用于uri(BLOB) 现在我把表中的水滴作为字符串。 我想在uri列中显示一个图标,当我单击它时,它会显示缓冲区的内容(我指的是文档)。 有解决方案吗?如果要在另一个窗口中打开它,可以执行以下操作: 类MyComponent扩展组件{ //…组件的其余部分 openBlob=fileBuffer=>{ const file=new Blob([fileBuff

在该页面中,用户显示一个包含三列的表,一列用于tipo_esame(string),一列用于data_esame(string),一列用于uri(BLOB)

现在我把表中的水滴作为字符串。 我想在uri列中显示一个图标,当我单击它时,它会显示缓冲区的内容(我指的是文档)。
有解决方案吗?

如果要在另一个窗口中打开它,可以执行以下操作:

类MyComponent扩展组件{
//…组件的其余部分
openBlob=fileBuffer=>{
const file=new Blob([fileBuffer]);//您还可以在此处添加MIME类型,即{type:“application/pdf”}
const fileURL=URL.createObjectURL(文件);
window.open(fileURL,“\u blank””;
};
render(){
//渲染函数的其余部分
const archivioItems=this.state.archivio.map((archivio,i)=>{
返回(
{archivio.tipo_esame}
{archivio.data_esame}
this.openBlob(archivio.uri)}>
);
});
}

}
archivio包含的一些示例内容如何?可能重复的内容是,Blob没有在这行“const file=new Blob([fileBuffer]);@mikerug88抱歉,可能是大写的L,应该是
Blob
。我编辑了我的答案。
const archivioItems = this.state.archivio.map((archivio, i) => {
  return (
  <tr  key={archivio.hash_referto}>
  <td>{archivio.tipo_esame}</td>
  <td>{archivio.data_esame}</td>
  <td>{archivio.uri}</td> 
</tr> 
  )
})

<table className="fixed_header">
      <thead>
  <tr >
      <th >Tipo esame</th>
      <th> Data Esame</th>
      <th>Vedi Referto</th>
    </tr >
    </thead>
    <tbody>
    {archivioItems}
    </tbody>
  </table>
  </div>
   )   
 }
}
{JSON.stringify(archivio.uri)}