我如何获得要在打字稿中的图像ID列中作为值输入的上传图像的标题?

问题描述 投票:0回答:1

Click to see the upload option当我选择一个图像文件时,它被选中,但是我无法提取所选择图像的标题。我需要获取此标题并将其作为列的一部分推到表中。有没有办法做同样的事情? Click to see the table fragment

reactjs typescript image-uploading
1个回答
1
投票

我不确定这是否是您要寻找的,但是您可以像这样通过onChange提取标题。

<input
  type="file"
  onChange={x => {
    console.log(x.target.files[0].name);
  }}
/>

这是沙箱example

© www.soinside.com 2019 - 2024. All rights reserved.