jquery - Aurelia 与 jquery.soap。如何导入和使用该模块

标签 jquery soap npm aurelia

我是 Aurelia 框架的新手。

我想调用 SOAP Web 服务,并找到了模块 jquery.soap ( https://www.npmjs.com/package/jquery.soap ) 来处理它。

我已在 aurelia.json 的依赖项中添加了该模块

   ..."jquery",
      "jquery.soap",
      {
        "name": "bootstrap",
        "path": "../node_modules/bootstrap/dist",
        "main": "js/bootstrap.min",
        "deps": ["jquery"],
        "exports": "$",
        "resources": [
          "css/bootstrap.css"
        ]
      },...

现在我将其导入 app.ts 并尝试像这样使用它

import $ from "jquery.soap"

export class App {
 $.soap({
    url: 'http://my.server.com/soapservices/',
    method: 'helloWorld',

    data: {
        name: 'Remy Blom',
        msg: 'Hi!'
    },

    success: function (soapResponse) {
        console.log("success");
    },
    error: function (SOAPResponse) {
        console.log("error");
    }
 });
}

我的问题是它找不到模块“jquery.soap”... 那么问题是,如何以正确的方式导入“jquery.soap”模块? 我也对使用该模块存有疑问。应该在 app.ts 中使用还是在 app.html 中使用?

最佳答案

只需导入插件:

import 'jquery.soap';

这在 js 中工作正常,在 ts 中你可能需要导入 jquery 以避免警告:

import * as $ from 'jquery';
import 'jquery.soap';

关于jquery - Aurelia 与 jquery.soap。如何导入和使用该模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42200981/

相关文章:

javascript - 循环遍历json对象并按顺序排序

java - Axis 故障 : (500)Internal Server Error

javascript - AngularJS SOAP 调用

javascript - 如何在 node.js 中安全地将本地文件路径转换为 ​​file::?/url?

node.js - 从 Angular 6 迁移到 Angular 7 导致错误 - 无法解析 'core-js/es7/reflect'

javascript - 点击mp4视频即可开始/播放嵌入式(iframe)youtube视频

javascript - 在数据库中存储多个可拖动项目的位置

javascript - 选中复选框时更改指定 div 中的图像

javascript - node.js:使用等待消耗 promise

node.js - 更新 Electron 版本后异常无法找到绑定(bind)文件