diff --git a/docs/uni-app-x/codegap.md b/docs/uni-app-x/codegap.md index c47132552552ab2b22a813705e513fee93bd4704..a6f700928d9178f1f78cbef5342e182484e6817d 100644 --- a/docs/uni-app-x/codegap.md +++ b/docs/uni-app-x/codegap.md @@ -229,9 +229,12 @@ uni.navigateTo({ 比如封装 `uni.request` 时,如果参数从函数外部传入,则需要指定参数类型,否则无法获取参数类型信息。 ```ts -export function request(options : RequestOptions) { +// 封装 +function request(options : RequestOptions) { uni.request(options) } +// 调用 +request({url: 'https://www.example.com/request'} as RequestOptions) ``` 如果需要查看更详细的参数类型信息,可通过鼠标右键点击转到定义,跳转 d.ts 文件进行查看,如下图所示: