我在我的React项目中有一个HTML表格。我想将该表格复制到剪贴板。
原始答案:Original Answer
<table id="sample">
<thead>
<th>Amount</th>
<th>Charges</th>
</thead>
<tbody>
<tr>{item.Amount}</tr>
<tr>{item.Charges}</tr>
</tbody>
</table>
这是表格结构。我没有包含任何React代码。
我参考了这个示例代码https://stackblitz.com/edit/js-copy-element?file=index.js。但它不是用React写的。
如何使用React代码将表格复制到剪贴板?原始答案:最初的回答。