我是 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/