我正在使用把手作为模板引擎,并且是把手的新手。我从API(edamam配方搜索api)传递了数据。当尝试使用表格中的隐藏值将附在每个配方卡上的配料阵列发回时,在服务器端出现错误。控制台显示
[对象对象],[对象对象],[对象对象],[对象对象],[对象对象],[对象对象] [对象对象],[对象对象],[对象对象],[对象对象],[对象对象],[对象对象]
尝试在服务器端注销时。不知道发生了什么。下面的代码:
<div class="container">
<header class="jumbotron">
<div class=container></div>
<h1>{{currentUser.username}}</h1>
<h1>Press save to add the recipes to your dashboard</h1>
<p>
<a class="btn btn-primary btn-large" href="/{{currentUser.username}}/recipes/dashboard">Go To Your Dashboard</a>
</p>
</header>
<div class="row text-center" style="display:flex; flex-wrap:wrap">
{{#each data}}
<div class="col-md-3 col-sm-6">
<div class="thumbnail">
<img src="{{recipe.image}}" alt="Recipe Pic">
<div class="caption">
<h4>
{{recipe.label}}
</h4>
<h5>
Ingredients
</h5>
{{!-- recipe.ingredients is an array of ingredient objects with text as a key --}}
{{#each recipe.ingredients}}
<p>{{text}}</p>
{{/each}}
</div>
<p>
<form id="buttonDesign" action="/recipes/dashboard" method="POST">
<input type="hidden" name="recName" value="{{this.recipe.label}}"/>
<input type="hidden" name="recImage" value="{{this.recipe.image}}"/>
<input type="hidden" name="recUrl" value="{{this.recipe.url}}"/>
<input type="hidden" name="recIngredients" value "{{this.recipe.ingredients}}"/>
<button class="btn btn-primary">Save</button>
</form>
</p>
</div>
</div>
{{/each}}
</div>
</div>
</div>
如上所述,当我在服务器端注销req.body.recIngredients时,[object, Object]出现错误。
慕工程0101907
慕婉清6462132
相关分类