如何在此处动态更改图标颜色:
var byillingvalues=[];
for(var i in this.state.Alldata){
byillingvalues.push({bycdata:this.state.Alldata[i].label})
}
var values=byillingvalues.map(function(d,idx){
let colors=["#F0F8FF","#FFE4C4","#8A2BE2"];
for(var i=0;i<=colors.length;i++){
if(i==idx){
return (<span key={idx}>{<i className="fa fa-square" aria-
hidden="true" color:colors[i]></i>} {d.bycdata} </span>);
}
}
});
如何动态更改图标颜色?
答案 0 :(得分:0)
color
属性需要是i
标记的样式。你需要写
<i className="fa fa-square"
aria-hidden="true"
style={{color:colors[i]}}>
</i>
答案 1 :(得分:0)
您可以使用以下
将属性传递给反应中的对象public function show($id)
{
/* Get All CSCS Images For User */
$my_images= Image::all();
/* Get User From ID */
$user = User::find($id);
/* Return View */
return view('users.show')->with('user', $user)->with('images', $my_images);
}
答案 2 :(得分:0)
var byillingvalues=[];
for(var i in this.state.Alldata){
byillingvalues.push({bycdata:this.state.Alldata[i].label})
}
var values=byillingvalues.map(function(d,idx){
let colors=
["#6cbe45","#347cb5","#6cc1e6","#9d6bad","#4ebe9f","#4ebe9f","#bed730"];
for(var i=0;i<colors.length;i++){
if(i==idx){
return (<span key={idx}>{<i className="fa fa-square" aria-
hidden="true" style={{color:colors[i]}}></i>} {d.bycdata}
</span>);
}
}
});