typescript调用javascript && URI.js

it2022-06-25  93

URI.js

URI.js是一个用于处理URL的JavaScript库它提供了一个“jQuery风格”的API(Fluent接口,方法链接)来读写所有常规组件和许多便利方法,如.directory()和.authority()本文以URI.js库为例进行讲解链接:http://medialize.github.io/URI.js/https://github.com/medialize/URI.js

ts使用js

安装URI.js

npm install urijs

配置tsconfig.json

{ "compilerOptions": { // 允许调用js "allowJs": true } }

使用js

import * as URL from 'urijs' // get请求 getRequest(url: string, params: any): Promise<any> { //... //把any转为key=value&key=value... url=url+'?'+URL.buildQuery(params); //... }

转载于:https://www.cnblogs.com/Lulus/p/8549784.html

相关资源:azure-database:用于Nest框架(node.js)的Azure数据库(表存储等)模块-源码

最新回复(0)