如何在nodejs的服务器端启用像sweetalert这样的验证?

问题描述

我正在尝试验证车把侧提交上的上传字段。有一种表单,其中有一个上载输入字段和一个提交按钮。单击提交时,我要在服务器端进行验证,如果上传字段为空,则在nodejs中进行输入。

我正在尝试使用sweetalert npm软件包,但无法正常工作。

车把代码

<form id="uploadForm" enctype="multipart/form-data" action="/api/upload/{{this.commonID}}/{{this.status}}" method="post">
    <td>
      <input type="file" class="btn btn-outline-warning" name="FileUploadForClient" multiple />
    </td>
    <td>
      <button type="submit" class="btn btn-primary btn-block">Submit</button>
</td>
</form> 

Nodejs侧包安装:

const swal = require('sweetalert');

并且我在提交时触发的路由中使用了以下swtalrt代码

swal("Good job!","You clicked the button!","success");

但不会弹出。

让我知道是否可以通过此npm软件包解决该问题,否则,如果您有建议,我需要其他解决方案。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)