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 +} +``` + + + + + + + + + + +