간단한 온라인 상점을 개발했습니다. js.file에서 다른 js로 데이터를 전달/제출하고 싶습니다. 첫 번째 js 파일에는 항목 표시가 있습니다. 그럼 난 테이블을 포함 cart.js에 데이터 항목을 전달하고 싶습니다. 내가 데이터를 정의하는 방법데이터 전달 중
<section className="products">
<div className="product-card">
<div className="product-image">
<img src={ bagiak }/>
</div>
<div className="product-info">
<h5>Bagiak Tidur</h5>
<h6>Rp.12000</h6>
<p>Masukkan Jumlah yang dibeli : </p><input type="number"/><br/><br/>
<a href="/keranjang" className="button is-success btn-product"><i className="fa fa-shopping-cart"></i> Beli</a>
</div>
</div>
</section>
(= "bagiak tidur", "가격"= "12000", "수량", "제품"= "1") 내가 테이블에 전달하려는? 버튼을 누르면 테이블에 데이터가 입력됩니다. 여기 내 테이블이 있습니다.
<table id="cart" className="table table-hover table-condensed">
<thead>
<tr>
<th styles="width:50%" className="text-center">Nama Produk</th>
<th styles="width:10%" className="text-center">Harga</th>
<th styles="width:8%" className="text-center">Jumlah</th>
<th styles="width:22%" className="text-center">Subtotal</th>
<th styles="width:10%" className="text-center">Action</th>
</tr>
</thead>
<tbody>
{this.state.json.map((data, i) => {
var subtotal = data.harga*data.jumlah;
const id = data.id;
return (
<tr key={i}>
<td data-th="Product">
<div className="row">
<div className="col-sm-10">
<h4 className="nomargin">{data.nama_barang}</h4>
</div>
</div>
</td>
<td data-th="Price">Rp.{data.harga}</td>
<td data-th="Quantity">{data.jumlah} </td>
<td data-th="Subtotal" className="text-center">Rp.{subtotal}</td>
<td className="actions" data-th="">
<button onClick={() => this.handleDelete(id) } className="button is-danger"><i className="fa fa-trash-o"></i></button>
</td>
</tr>);
})}
</tbody>
<tfoot>
<tr>
<td><Link to ="/" className="button is-warning"><i className="fa fa-angle-left"></i> Lanjut Berbelanja</Link></td>
<td></td>
<td>Total </td>
<td className="hidden-xs text-center"><strong>Rp. { total }</strong></td>
<td><Link to ="/transaksi" className="button is-success">Checkout <i className="fa fa-angle-right"></i></Link></td>
</tr>
</tfoot>
</table>
i 개발 된 UI 웹 사이트. 그래서 그것은 어떤 데이터베이스와도 연결되지 않습니다. 모든 데이터는 UI 수준에 있습니다. 내가 무슨 뜻인지 알기를 바랍니다. 나쁜 영어로 죄송합니다.