我想在选中一行中的单选按钮时,将表格整行的值传递给函数.这是表格代码
<table className="table table-bordered table-stripped">
<thead>
<th>AD Type</th>
<th>AD Title</th>
<th>Image/Video URL</th>
<th>Video Thumbnail</th>
<th>Landing URL</th>
<th>Placement</th>
<th>Country</th>
<th>DSP</th>
<th>Select</th>
</thead>
<tbody>
{
creative.map(
creative =>
<tr key = {creative.id}>
<td>{creative.ad_type}</td>
<td>{creative.ad_title}</td>
<td>{creative.image_url}</td>
<td>{creative.video_thumbnail}</td>
<td>{creative.landing_url}</td>
<td>{creative.placement}</td>
<td>{creative.country}</td>
<td>{creative.dsp}</td>
<td> <input type="radio" class="checkbox1" id="chk" name="check[]" value={creative} onClick={func1} /></td>
</tr>
)
}
</tbody>
</table>
函数func1
只记录值
const func1 = (e) => {
console.log(e.target.value);
}
当我使用value = {creative}
时,记录的输出是[object Object]
.