我在node.js中做了一個應用程序,在本地測試工程中,但是當部署AWS時,我得到這個錯誤「dates.map不是函數」。TypeError:dates.map不是函數
我離開了代碼,我得到錯誤。謝謝。
module.exports = function (ctx, dates) {
console.log(dates);
var authenticated = yo`<div class="container timeline cont-estadisticas">
<div id="top-menu" class="container">
<div class="row">
<ul class="tabs-menu-redes">
<li class="current"><a href="#facebook"><i class="fa fa-facebook" aria-hidden="true"></i>Facebook</a></li>
<li><a href="#instagram"><i class="fa fa-instagram" aria-hidden="true"></i>Instagram</a></li>
<li><a href="#twitter"><i class="fa fa-twitter" aria-hidden="true"></i>Twitter</a></li>
</ul>
</div>
</div>
<div id="stadistitics-container" class="cont-redes tab-content">
<div id="facebook" class="row tab-content-redes" style="display:block" >
${dates.map(function (dato){
if(dato.userId === ctx.auth.username){
hay = buscardatosfb(ctx, dates, dato);
if(hay === 1){
hay = 0;
++mostrardatosfb
if(mostrardatosfb === 1){
return yo``
}
})}
</ul>
</div>
<div class="cont-meses">
${dates.map(function (dato){
if(dato.userId === ctx.auth.username & dato.red === 'fb'){
if(dato.type === 'year' ){
return vistaano (dato);
}else{
return vistadato (dato);
}
}
})}
</div></div>`
}
}
}
})}
</div>
</div>
</div>`
這是在控制檯中的錯誤:
TypeError: dates.map is not a function
at module.exports (app.js:21190)
at $.fn.countTo.options (app.js:20940)
at app.js:14574
at nextEnter (app.js:14406)
at app.js:21112
謝謝!
只顯示需要的代碼! – sandrooco