Express js 中是否有 dom 事件侦听器的替代方案

发布于 2025-01-16 14:42:18 字数 149 浏览 1 评论 0原文

由于express js不允许Dom相关命令,所以我无法跟踪按钮,即单击按钮的时间。不仅仅是点击按钮,任何类型的跟踪都是不可能的。任何人都可以建议一个替代方案吗?如果 Express 中没有任何内容,一个新的图书馆或任何可以与 Express 一起使用并帮助我解决这个问题的东西。谢谢

since express js doesn't allow Dom related commands, so I am not able to keep tracks of buttons i.e. when they are clicked. Not just button clicking but any kind of tracking is not possible. Can anyone please suggest a alternate for this. If there is nothing in express, a new library or anything that can work with express and help me with this. Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我做我的改变 2025-01-23 14:42:18

你在这里混淆了事情。 Express.js 在后端运行。后端没有 DOM,因此没有 API 来操作 DOM。

您可以使用模板引擎(快速支持,例如 handlebarsEJS)并链接您返回的 HTML 中的 JavaScript 文件。或者您使用 React、Vue、Svelte、Angular 等前端框架来执行此操作。

You are confusing things here. Express.js runs on the backend. There is no DOM on the backend, hence there is no API to manipulate the DOM.

You can use template engines (express supports e.g. handlebars and EJS) and link JavaScript files within the HTML that you return. Or you use a frontend framework like React, Vue, Svelte, Angular etc. in order to do this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文