From 814ca317ae71e3381ea857e9d46fea693ff0aa85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8A=98=E8=85=BE=E7=AC=94=E8=AE=B0?= Date: Tue, 23 Jul 2019 03:58:27 +0800 Subject: [PATCH] update types for uni-app (#36749) * fix: getStoragetSync return value is incorrect. * fix: The type of return value type of Storage is incorrect * added parameter for GetStorageOptions.success * added value parameter for setStorageSync * fix setStorageSync with value: any * update types for uni-app * add class EditorContext for uni-app types * fix lint for uni-app * remove *.vue module for uni-app * update types for uni-app * update types for uni-app * update types for uni-app * update types for uni-app * update types for uni-app * update types for uni-app --- types/uni-app/lib/uni.d.ts | 6 +++--- types/uni-app/uni-app-tests.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) 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'); + } +});