Skip to content

Commit

Permalink
feat: 优化图片跨域
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasuo committed Aug 18, 2021
1 parent 0017a7d commit e754efe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "json-to-canvas",
"version": "1.0.2",
"version": "1.0.3",
"description": "json-to-canvas",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { DrawRoundRectType, FillRoundRectType, GetTextHeightType, GetTextsType,
export const loadImage = (url: string): Promise<HTMLImageElement> => {
return new Promise((resolve, reject) => {
const imgItem = new Image();
if (url.match(/^https?/)) imgItem.crossOrigin = 'anonymous';
imgItem.crossOrigin = 'anonymous';
imgItem.onload = () => {
resolve(imgItem);
};
Expand Down

0 comments on commit e754efe

Please sign in to comment.