From ed5360e0f07d1fe9d24d30740522d4e4d9a9721a Mon Sep 17 00:00:00 2001 From: GauharChan <2464231008@qq.com> Date: Thu, 11 Jan 2024 15:36:22 +0800 Subject: [PATCH] =?UTF-8?q?wip:=20=E8=8E=B7=E5=8F=96dpr?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...70\347\224\250\344\273\243\347\240\201.md" | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git "a/docs/\345\267\245\344\275\234\345\270\270\347\224\250\344\273\243\347\240\201.md" "b/docs/\345\267\245\344\275\234\345\270\270\347\224\250\344\273\243\347\240\201.md" index 1c5d12d..151d15d 100644 --- "a/docs/\345\267\245\344\275\234\345\270\270\347\224\250\344\273\243\347\240\201.md" +++ "b/docs/\345\267\245\344\275\234\345\270\270\347\224\250\344\273\243\347\240\201.md" @@ -965,3 +965,39 @@ export function downLoadByBlob(res) { window.URL.revokeObjectURL(href); // 释放掉blob对象 } ``` + +### 微信H5打开小程序 + +https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html#21 + +### web获取dpr + +传递`canvas`的`context` + +```ts +function getRatio (context: any): number { + if (!context) { + return 1 + } + const backingStore = + context.backingStorePixelRatio || + context.webkitBackingStorePixelRatio || + context.mozBackingStorePixelRatio || + context.msBackingStorePixelRatio || + context.oBackingStorePixelRatio || + context.backingStorePixelRatio || + 1 + return (window.devicePixelRatio || 1) / backingStore +} +``` + + + + + + + + + + +