typescript调用javascript && URI.js

URI.js
URI.js is a JavaScript library for handling URL
it provides a "jQuery style" API (Fluent interfaces, methods, links) to read and write all conventional components and many convenient methods, such as .directory () and. authority ()
In this paper, an example to explain URI.js library
link:
http://medialize.github.io/URI.js/
https://github.com/medialize/URI.js

ts using js
mounted URI.js
NPM the install urijs
arranged tsconfig.json
{
"the compilerOptions": {
// allows calling js
"allowJs": to true
}
}
using js
Import from the URL * AS 'urijs'

// get请求
getRequest(url: string, params: any): Promise {
// ...
// Switch to any value = & Key = Key value ...
URL = + + URL.buildQuery URL (the params) '?';
// ...
}

Guess you like

Origin www.cnblogs.com/Lulus/p/12602890.html