【发布时间】:2022-01-06 06:09:05
【问题描述】:
您好,我正在导入value json。
console.log(value);
> Object Array(10)
> 0
imageUrl: "http://stackoverflow/images/0,"
> 1
imageUrl: "http://stackoverflow/images/1,"
> 2
imageUrl: "http://stackoverflow/images/2,"
> 3
imageUrl: "http://stackoverflow/images/3,"
> 4
imageUrl: "http://stackoverflow/images/4,"
> 5
imageUrl:"http://stackoverflow/images/0http://stackoverflow/images/0,"
...
const Minsu = () => {
return (
<>
<img src={value[0].imageUrl} />
</>
)
}
我的问题是由于imageUrl中的这个,,图像没有正确输出,我只想删除这个字符串','。
但是,我尝试使用过滤器仅删除“,”字符串,但它表示无法使用过滤器,因为 imageUrl 是一个字符串。
字符串我想从特定字符串中删除',',我该怎么做?
如果imageUrl中有http://stackoverflow/images/0http://stackoverflow/images/0,我想删除一个http。
【问题讨论】:
标签: javascript reactjs ecmascript-6 frontend