diff --git a/types/uni-app/lib/uni.d.ts b/types/uni-app/lib/uni.d.ts index 4c1403c674..49123dc195 100644 --- a/types/uni-app/lib/uni.d.ts +++ b/types/uni-app/lib/uni.d.ts @@ -81,7 +81,7 @@ declare class Uni { * * 参考: [http://uniapp.dcloud.io/frame?id=upx2px](http://uniapp.dcloud.io/frame?id=upx2px) */ - upx2px(upx: number): number; + upx2px(upx?: number): number; /** * 创建一个 WebSocket 连接 * @@ -5285,11 +5285,11 @@ interface CanvasToTempFilePathOptions { /** * 输出图片宽度(默认为 width * 屏幕像素密度) */ - destWidth?: boolean; + destWidth?: number; /** * 输出图片高度(默认为 height * 屏幕像素密度) */ - destHeight?: () => void; + destHeight?: number; /** * 画布标识,传入 的 canvas-id */ diff --git a/types/uni-app/uni-app-tests.ts b/types/uni-app/uni-app-tests.ts index 455fe77a5b..9718681d5c 100644 --- a/types/uni-app/uni-app-tests.ts +++ b/types/uni-app/uni-app-tests.ts @@ -28,3 +28,20 @@ uni.createSelectorQuery().select('.test').context(res => { } }); }); + +const px: number = uni.upx2px(750); + +uni.canvasToTempFilePath({ + x: 0, + y: 0, + width: 100, + height: 100, + destWidth: 100, + destHeight: 100, + canvasId: 'test', + fileType: 'png', + quality: 1, + success() { + console.log('canvasToTempFilePath success'); + } +});