Skip to content

Commit a98247e

Browse files
authored
refactor(Html2Image): bump version 9.0.0-beta02 (#335)
* refactor: 更新代码 * chore: bump version 9.0.0-beta02
1 parent c877a30 commit a98247e

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/components/BootstrapBlazor.Html2Image/BootstrapBlazor.Html2Image.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.0.0-beta01</Version>
4+
<Version>9.0.0-beta02</Version>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/components/BootstrapBlazor.Html2Image/wwwroot/html2image.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export async function execute(selector, methodName, options) {
44
let data = null;
55
const el = document.querySelector(selector);
66
if (el) {
7+
options ??= {};
78
const fn = methodName === 'toBlob'
89
? htmlToImage[methodName]
910
: getMethod(options);
@@ -14,13 +15,11 @@ export async function execute(selector, methodName, options) {
1415

1516
const getMethod = options => {
1617
let ret = "toPng";
17-
if (options) {
18-
const { methodName } = options;
19-
delete options.methodName;
18+
const {methodName} = options;
19+
delete options.methodName;
2020

21-
if (['toPng', 'toJpeg', 'toSvg', 'toCanvas'].find(i => i === methodName)) {
22-
ret = methodName;
23-
}
21+
if (['toPng', 'toJpeg', 'toSvg', 'toCanvas'].find(i => i === methodName)) {
22+
ret = methodName;
2423
}
2524
return htmlToImage[ret];
2625
}

0 commit comments

Comments
 (0)