gpt4 book ai didi

javascript - ejs 页面中未定义relativeTime() 实用程序

转载 作者:太空宇宙 更新时间:2023-11-04 01:13:26 25 4
gpt4 key购买 nike

使用 GeddyJS 我创建了一个网络应用程序。

我有一个表,其中的日期时间是相对的(“自...以来 5 分钟”)。但是,当我在页面中使用 GeddyJS 文档中的函数时,它不可用。它说

C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:74
throw err;
^
TypeError: ejs:28
26| <td><%= people[i].location %></td>
27| <td><%= people[i].recorder %></td>
>> 28| <td><%= geddy.relativeTime(new Date(people[i].time)) %></td>
29| <td><%= people[i].direction %></td>
30| <td><%= people[i].transportation %></td>
31| <td>(<%= people[i].id %>)</td>
Object #<Object> has no method 'relativeTime'
at Template.handleErr (C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:58:15)
at Object.Template.compile.rethrow (C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:90:41)

我该如何调用电话?

最佳答案

看起来您应该使用 geddy.date.relativeTime 而不是 geddy.relativeTime

关于javascript - ejs 页面中未定义relativeTime() 实用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13828613/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com