我的后端有这个:
app.get('/dashboard', async(req, res) => {
const customers = await stripe.customers.list();
customers.data.forEach(customer => {
// console.log(customer.metadata);
});
res.render('dashboard.ejs', {customer: customers})
console.log(customers)
})
在我的前端(ejs):
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>NAME</th>
<th>EMAIL</th>
<th>ACTIONS</th>
</tr>
</thead>
<tbody>
<% if(customer.data.length){
for(var i = 0;i < customer.data.length;i++) { %>
<tr>
<script>
let kk = JSON.stringify('<%=customer.data%>')
console.log(kk)
</script>
<td><%=customer.data%></td>
<% }
}else{ %>
<p>err</p>
<% } %>
</tr>
</tbody>
</table>
但是当我登录时kk,它会返回[object Object],当我把它放到屏幕上时也是如此,正如你在上面看到的那样。我怎样才能解决这个问题?