@deot/vc-components 1.0.52 → 1.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +36 -42
- package/dist/index.d.ts +8 -4
- package/dist/index.iife.js +36 -42
- package/dist/index.js +36 -42
- package/dist/index.umd.cjs +36 -42
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -73,6 +73,10 @@ const defaults$2 = {
|
|
|
73
73
|
},
|
|
74
74
|
TableColumn: {
|
|
75
75
|
line: nil
|
|
76
|
+
},
|
|
77
|
+
Snapshot: {
|
|
78
|
+
source: nil,
|
|
79
|
+
download: nil
|
|
76
80
|
}
|
|
77
81
|
};
|
|
78
82
|
|
|
@@ -10847,14 +10851,18 @@ const Upload$1 = vue.defineComponent({
|
|
|
10847
10851
|
}
|
|
10848
10852
|
let { enhancer } = VcInstance.options.Upload || {};
|
|
10849
10853
|
enhancer = props.enhancer || enhancer || (() => false);
|
|
10850
|
-
const
|
|
10851
|
-
if (
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
+
const skip = enhancer(instance);
|
|
10855
|
+
if (skip && skip.then) {
|
|
10856
|
+
let skip$ = false;
|
|
10857
|
+
skip.then((v) => {
|
|
10858
|
+
skip$ = typeof v === "undefined" ? true : !!v;
|
|
10859
|
+
return v;
|
|
10860
|
+
}).finally(() => {
|
|
10861
|
+
skip$ || el.click?.();
|
|
10854
10862
|
});
|
|
10855
10863
|
return;
|
|
10856
10864
|
}
|
|
10857
|
-
|
|
10865
|
+
skip || el.click();
|
|
10858
10866
|
};
|
|
10859
10867
|
const handleChange = (e) => {
|
|
10860
10868
|
uploadFiles(e.target.files);
|
|
@@ -12122,7 +12130,8 @@ const props$H = {
|
|
|
12122
12130
|
default: "anonymous",
|
|
12123
12131
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12124
12132
|
},
|
|
12125
|
-
|
|
12133
|
+
source: Function,
|
|
12134
|
+
download: Function,
|
|
12126
12135
|
// 传递给snap-dom的配置项
|
|
12127
12136
|
options: {
|
|
12128
12137
|
type: Object,
|
|
@@ -12142,63 +12151,48 @@ const Snapshot = /* @__PURE__ */ vue.defineComponent({
|
|
|
12142
12151
|
slots,
|
|
12143
12152
|
expose
|
|
12144
12153
|
}) {
|
|
12154
|
+
let snapDOM;
|
|
12155
|
+
const instance = vue.getCurrentInstance();
|
|
12145
12156
|
const current = vue.ref();
|
|
12146
|
-
const
|
|
12147
|
-
|
|
12148
|
-
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12157
|
+
const snapdom = vue.ref();
|
|
12149
12158
|
const refresh = async () => {
|
|
12150
|
-
|
|
12151
|
-
|
|
12152
|
-
return
|
|
12153
|
-
return new Promise(resolve => {
|
|
12154
|
-
(async () => {
|
|
12155
|
-
let url;
|
|
12156
|
-
try {
|
|
12157
|
-
url = await transformSource(node.src);
|
|
12158
|
-
} catch (e) {
|
|
12159
|
-
console.error(e);
|
|
12160
|
-
}
|
|
12161
|
-
const image = new Image();
|
|
12162
|
-
image.crossOrigin = props.crossOrigin;
|
|
12163
|
-
image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
|
|
12164
|
-
image.onload = () => {
|
|
12165
|
-
node.src = image.src;
|
|
12166
|
-
resolve(1);
|
|
12167
|
-
};
|
|
12168
|
-
image.onerror = () => resolve(0);
|
|
12169
|
-
})();
|
|
12170
|
-
});
|
|
12171
|
-
}));
|
|
12159
|
+
await vue.nextTick();
|
|
12160
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
12161
|
+
return snapdom.value;
|
|
12172
12162
|
};
|
|
12173
12163
|
const toDataURL = async () => {
|
|
12174
12164
|
await refresh();
|
|
12175
|
-
return
|
|
12165
|
+
return snapdom.value.toRaw();
|
|
12176
12166
|
};
|
|
12177
12167
|
const download = async options => {
|
|
12178
12168
|
await refresh();
|
|
12179
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
12180
|
-
const
|
|
12181
|
-
if (
|
|
12182
|
-
|
|
12183
|
-
|
|
12169
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
12170
|
+
const skip = _download(instance, options);
|
|
12171
|
+
if (skip && skip.then) {
|
|
12172
|
+
let skip$ = false;
|
|
12173
|
+
skip.then(v => {
|
|
12174
|
+
skip$ = typeof v === 'undefined' ? true : !!v;
|
|
12175
|
+
return v;
|
|
12176
|
+
}).finally(() => {
|
|
12177
|
+
skip$ || snapdom.value.download(options);
|
|
12184
12178
|
});
|
|
12185
12179
|
return;
|
|
12186
12180
|
}
|
|
12187
|
-
|
|
12181
|
+
skip || snapdom.value.download(options);
|
|
12188
12182
|
};
|
|
12189
12183
|
expose({
|
|
12190
|
-
|
|
12184
|
+
snapdom,
|
|
12191
12185
|
refresh,
|
|
12192
12186
|
toDataURL,
|
|
12193
12187
|
download
|
|
12194
12188
|
});
|
|
12195
12189
|
vue.onMounted(async () => {
|
|
12196
12190
|
try {
|
|
12197
|
-
|
|
12191
|
+
snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12198
12192
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12199
|
-
|
|
12193
|
+
await refresh();
|
|
12200
12194
|
emit('ready', {
|
|
12201
|
-
instance
|
|
12195
|
+
instance,
|
|
12202
12196
|
dependencies: {
|
|
12203
12197
|
snapDOM
|
|
12204
12198
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -8427,7 +8427,8 @@ type: StringConstructor;
|
|
|
8427
8427
|
default: string;
|
|
8428
8428
|
validator: (v: any) => boolean;
|
|
8429
8429
|
};
|
|
8430
|
-
|
|
8430
|
+
source: FunctionConstructor;
|
|
8431
|
+
download: FunctionConstructor;
|
|
8431
8432
|
options: {
|
|
8432
8433
|
type: ObjectConstructor;
|
|
8433
8434
|
default: () => {};
|
|
@@ -8442,7 +8443,8 @@ type: StringConstructor;
|
|
|
8442
8443
|
default: string;
|
|
8443
8444
|
validator: (v: any) => boolean;
|
|
8444
8445
|
};
|
|
8445
|
-
|
|
8446
|
+
source: FunctionConstructor;
|
|
8447
|
+
download: FunctionConstructor;
|
|
8446
8448
|
options: {
|
|
8447
8449
|
type: ObjectConstructor;
|
|
8448
8450
|
default: () => {};
|
|
@@ -13308,7 +13310,8 @@ type: StringConstructor;
|
|
|
13308
13310
|
default: string;
|
|
13309
13311
|
validator: (v: any) => boolean;
|
|
13310
13312
|
};
|
|
13311
|
-
|
|
13313
|
+
source: FunctionConstructor;
|
|
13314
|
+
download: FunctionConstructor;
|
|
13312
13315
|
options: {
|
|
13313
13316
|
type: ObjectConstructor;
|
|
13314
13317
|
default: () => {};
|
|
@@ -13323,7 +13326,8 @@ type: StringConstructor;
|
|
|
13323
13326
|
default: string;
|
|
13324
13327
|
validator: (v: any) => boolean;
|
|
13325
13328
|
};
|
|
13326
|
-
|
|
13329
|
+
source: FunctionConstructor;
|
|
13330
|
+
download: FunctionConstructor;
|
|
13327
13331
|
options: {
|
|
13328
13332
|
type: ObjectConstructor;
|
|
13329
13333
|
default: () => {};
|
package/dist/index.iife.js
CHANGED
|
@@ -35,6 +35,10 @@ var VcComponents = (function (exports, vue) {
|
|
|
35
35
|
},
|
|
36
36
|
TableColumn: {
|
|
37
37
|
line: nil
|
|
38
|
+
},
|
|
39
|
+
Snapshot: {
|
|
40
|
+
source: nil,
|
|
41
|
+
download: nil
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
|
|
@@ -19258,14 +19262,18 @@ var VcComponents = (function (exports, vue) {
|
|
|
19258
19262
|
}
|
|
19259
19263
|
let { enhancer } = VcInstance.options.Upload || {};
|
|
19260
19264
|
enhancer = props.enhancer || enhancer || (() => false);
|
|
19261
|
-
const
|
|
19262
|
-
if (
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
+
const skip = enhancer(instance);
|
|
19266
|
+
if (skip && skip.then) {
|
|
19267
|
+
let skip$ = false;
|
|
19268
|
+
skip.then((v) => {
|
|
19269
|
+
skip$ = typeof v === "undefined" ? true : !!v;
|
|
19270
|
+
return v;
|
|
19271
|
+
}).finally(() => {
|
|
19272
|
+
skip$ || el.click?.();
|
|
19265
19273
|
});
|
|
19266
19274
|
return;
|
|
19267
19275
|
}
|
|
19268
|
-
|
|
19276
|
+
skip || el.click();
|
|
19269
19277
|
};
|
|
19270
19278
|
const handleChange = (e) => {
|
|
19271
19279
|
uploadFiles(e.target.files);
|
|
@@ -20665,7 +20673,8 @@ var VcComponents = (function (exports, vue) {
|
|
|
20665
20673
|
default: "anonymous",
|
|
20666
20674
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
20667
20675
|
},
|
|
20668
|
-
|
|
20676
|
+
source: Function,
|
|
20677
|
+
download: Function,
|
|
20669
20678
|
// 传递给snap-dom的配置项
|
|
20670
20679
|
options: {
|
|
20671
20680
|
type: Object,
|
|
@@ -20685,63 +20694,48 @@ var VcComponents = (function (exports, vue) {
|
|
|
20685
20694
|
slots,
|
|
20686
20695
|
expose
|
|
20687
20696
|
}) {
|
|
20697
|
+
let snapDOM;
|
|
20698
|
+
const instance = vue.getCurrentInstance();
|
|
20688
20699
|
const current = vue.ref();
|
|
20689
|
-
const
|
|
20690
|
-
|
|
20691
|
-
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
20700
|
+
const snapdom = vue.ref();
|
|
20692
20701
|
const refresh = async () => {
|
|
20693
|
-
|
|
20694
|
-
|
|
20695
|
-
return
|
|
20696
|
-
return new Promise(resolve => {
|
|
20697
|
-
(async () => {
|
|
20698
|
-
let url;
|
|
20699
|
-
try {
|
|
20700
|
-
url = await transformSource(node.src);
|
|
20701
|
-
} catch (e) {
|
|
20702
|
-
console.error(e);
|
|
20703
|
-
}
|
|
20704
|
-
const image = new Image();
|
|
20705
|
-
image.crossOrigin = props.crossOrigin;
|
|
20706
|
-
image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
|
|
20707
|
-
image.onload = () => {
|
|
20708
|
-
node.src = image.src;
|
|
20709
|
-
resolve(1);
|
|
20710
|
-
};
|
|
20711
|
-
image.onerror = () => resolve(0);
|
|
20712
|
-
})();
|
|
20713
|
-
});
|
|
20714
|
-
}));
|
|
20702
|
+
await vue.nextTick();
|
|
20703
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
20704
|
+
return snapdom.value;
|
|
20715
20705
|
};
|
|
20716
20706
|
const toDataURL = async () => {
|
|
20717
20707
|
await refresh();
|
|
20718
|
-
return
|
|
20708
|
+
return snapdom.value.toRaw();
|
|
20719
20709
|
};
|
|
20720
20710
|
const download = async options => {
|
|
20721
20711
|
await refresh();
|
|
20722
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
20723
|
-
const
|
|
20724
|
-
if (
|
|
20725
|
-
|
|
20726
|
-
|
|
20712
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
20713
|
+
const skip = _download(instance, options);
|
|
20714
|
+
if (skip && skip.then) {
|
|
20715
|
+
let skip$ = false;
|
|
20716
|
+
skip.then(v => {
|
|
20717
|
+
skip$ = typeof v === 'undefined' ? true : !!v;
|
|
20718
|
+
return v;
|
|
20719
|
+
}).finally(() => {
|
|
20720
|
+
skip$ || snapdom.value.download(options);
|
|
20727
20721
|
});
|
|
20728
20722
|
return;
|
|
20729
20723
|
}
|
|
20730
|
-
|
|
20724
|
+
skip || snapdom.value.download(options);
|
|
20731
20725
|
};
|
|
20732
20726
|
expose({
|
|
20733
|
-
|
|
20727
|
+
snapdom,
|
|
20734
20728
|
refresh,
|
|
20735
20729
|
toDataURL,
|
|
20736
20730
|
download
|
|
20737
20731
|
});
|
|
20738
20732
|
vue.onMounted(async () => {
|
|
20739
20733
|
try {
|
|
20740
|
-
|
|
20734
|
+
snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
|
|
20741
20735
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
20742
|
-
|
|
20736
|
+
await refresh();
|
|
20743
20737
|
emit('ready', {
|
|
20744
|
-
instance
|
|
20738
|
+
instance,
|
|
20745
20739
|
dependencies: {
|
|
20746
20740
|
snapDOM
|
|
20747
20741
|
}
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,10 @@ const defaults$2 = {
|
|
|
51
51
|
},
|
|
52
52
|
TableColumn: {
|
|
53
53
|
line: nil
|
|
54
|
+
},
|
|
55
|
+
Snapshot: {
|
|
56
|
+
source: nil,
|
|
57
|
+
download: nil
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
|
|
@@ -10825,14 +10829,18 @@ const Upload$1 = defineComponent({
|
|
|
10825
10829
|
}
|
|
10826
10830
|
let { enhancer } = VcInstance.options.Upload || {};
|
|
10827
10831
|
enhancer = props.enhancer || enhancer || (() => false);
|
|
10828
|
-
const
|
|
10829
|
-
if (
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
+
const skip = enhancer(instance);
|
|
10833
|
+
if (skip && skip.then) {
|
|
10834
|
+
let skip$ = false;
|
|
10835
|
+
skip.then((v) => {
|
|
10836
|
+
skip$ = typeof v === "undefined" ? true : !!v;
|
|
10837
|
+
return v;
|
|
10838
|
+
}).finally(() => {
|
|
10839
|
+
skip$ || el.click?.();
|
|
10832
10840
|
});
|
|
10833
10841
|
return;
|
|
10834
10842
|
}
|
|
10835
|
-
|
|
10843
|
+
skip || el.click();
|
|
10836
10844
|
};
|
|
10837
10845
|
const handleChange = (e) => {
|
|
10838
10846
|
uploadFiles(e.target.files);
|
|
@@ -12100,7 +12108,8 @@ const props$H = {
|
|
|
12100
12108
|
default: "anonymous",
|
|
12101
12109
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
12102
12110
|
},
|
|
12103
|
-
|
|
12111
|
+
source: Function,
|
|
12112
|
+
download: Function,
|
|
12104
12113
|
// 传递给snap-dom的配置项
|
|
12105
12114
|
options: {
|
|
12106
12115
|
type: Object,
|
|
@@ -12120,63 +12129,48 @@ const Snapshot = /* @__PURE__ */ defineComponent({
|
|
|
12120
12129
|
slots,
|
|
12121
12130
|
expose
|
|
12122
12131
|
}) {
|
|
12132
|
+
let snapDOM;
|
|
12133
|
+
const instance = getCurrentInstance();
|
|
12123
12134
|
const current = ref();
|
|
12124
|
-
const
|
|
12125
|
-
|
|
12126
|
-
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
12135
|
+
const snapdom = ref();
|
|
12127
12136
|
const refresh = async () => {
|
|
12128
|
-
|
|
12129
|
-
|
|
12130
|
-
return
|
|
12131
|
-
return new Promise(resolve => {
|
|
12132
|
-
(async () => {
|
|
12133
|
-
let url;
|
|
12134
|
-
try {
|
|
12135
|
-
url = await transformSource(node.src);
|
|
12136
|
-
} catch (e) {
|
|
12137
|
-
console.error(e);
|
|
12138
|
-
}
|
|
12139
|
-
const image = new Image();
|
|
12140
|
-
image.crossOrigin = props.crossOrigin;
|
|
12141
|
-
image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
|
|
12142
|
-
image.onload = () => {
|
|
12143
|
-
node.src = image.src;
|
|
12144
|
-
resolve(1);
|
|
12145
|
-
};
|
|
12146
|
-
image.onerror = () => resolve(0);
|
|
12147
|
-
})();
|
|
12148
|
-
});
|
|
12149
|
-
}));
|
|
12137
|
+
await nextTick();
|
|
12138
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
12139
|
+
return snapdom.value;
|
|
12150
12140
|
};
|
|
12151
12141
|
const toDataURL = async () => {
|
|
12152
12142
|
await refresh();
|
|
12153
|
-
return
|
|
12143
|
+
return snapdom.value.toRaw();
|
|
12154
12144
|
};
|
|
12155
12145
|
const download = async options => {
|
|
12156
12146
|
await refresh();
|
|
12157
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
12158
|
-
const
|
|
12159
|
-
if (
|
|
12160
|
-
|
|
12161
|
-
|
|
12147
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
12148
|
+
const skip = _download(instance, options);
|
|
12149
|
+
if (skip && skip.then) {
|
|
12150
|
+
let skip$ = false;
|
|
12151
|
+
skip.then(v => {
|
|
12152
|
+
skip$ = typeof v === 'undefined' ? true : !!v;
|
|
12153
|
+
return v;
|
|
12154
|
+
}).finally(() => {
|
|
12155
|
+
skip$ || snapdom.value.download(options);
|
|
12162
12156
|
});
|
|
12163
12157
|
return;
|
|
12164
12158
|
}
|
|
12165
|
-
|
|
12159
|
+
skip || snapdom.value.download(options);
|
|
12166
12160
|
};
|
|
12167
12161
|
expose({
|
|
12168
|
-
|
|
12162
|
+
snapdom,
|
|
12169
12163
|
refresh,
|
|
12170
12164
|
toDataURL,
|
|
12171
12165
|
download
|
|
12172
12166
|
});
|
|
12173
12167
|
onMounted(async () => {
|
|
12174
12168
|
try {
|
|
12175
|
-
|
|
12169
|
+
snapDOM = window.snapdom || (await import('@zumer/snapdom'));
|
|
12176
12170
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
12177
|
-
|
|
12171
|
+
await refresh();
|
|
12178
12172
|
emit('ready', {
|
|
12179
|
-
instance
|
|
12173
|
+
instance,
|
|
12180
12174
|
dependencies: {
|
|
12181
12175
|
snapDOM
|
|
12182
12176
|
}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
TableColumn: {
|
|
40
40
|
line: nil
|
|
41
|
+
},
|
|
42
|
+
Snapshot: {
|
|
43
|
+
source: nil,
|
|
44
|
+
download: nil
|
|
41
45
|
}
|
|
42
46
|
};
|
|
43
47
|
|
|
@@ -19261,14 +19265,18 @@
|
|
|
19261
19265
|
}
|
|
19262
19266
|
let { enhancer } = VcInstance.options.Upload || {};
|
|
19263
19267
|
enhancer = props.enhancer || enhancer || (() => false);
|
|
19264
|
-
const
|
|
19265
|
-
if (
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
+
const skip = enhancer(instance);
|
|
19269
|
+
if (skip && skip.then) {
|
|
19270
|
+
let skip$ = false;
|
|
19271
|
+
skip.then((v) => {
|
|
19272
|
+
skip$ = typeof v === "undefined" ? true : !!v;
|
|
19273
|
+
return v;
|
|
19274
|
+
}).finally(() => {
|
|
19275
|
+
skip$ || el.click?.();
|
|
19268
19276
|
});
|
|
19269
19277
|
return;
|
|
19270
19278
|
}
|
|
19271
|
-
|
|
19279
|
+
skip || el.click();
|
|
19272
19280
|
};
|
|
19273
19281
|
const handleChange = (e) => {
|
|
19274
19282
|
uploadFiles(e.target.files);
|
|
@@ -20668,7 +20676,8 @@
|
|
|
20668
20676
|
default: "anonymous",
|
|
20669
20677
|
validator: (v) => /^(|anonymous|use-credentials)$/.test(v)
|
|
20670
20678
|
},
|
|
20671
|
-
|
|
20679
|
+
source: Function,
|
|
20680
|
+
download: Function,
|
|
20672
20681
|
// 传递给snap-dom的配置项
|
|
20673
20682
|
options: {
|
|
20674
20683
|
type: Object,
|
|
@@ -20688,63 +20697,48 @@
|
|
|
20688
20697
|
slots,
|
|
20689
20698
|
expose
|
|
20690
20699
|
}) {
|
|
20700
|
+
let snapDOM;
|
|
20701
|
+
const instance = vue.getCurrentInstance();
|
|
20691
20702
|
const current = vue.ref();
|
|
20692
|
-
const
|
|
20693
|
-
|
|
20694
|
-
// 网络的图片如果没有加上crossOrigin,且没有放在第一个就会出现问题(Safari)
|
|
20703
|
+
const snapdom = vue.ref();
|
|
20695
20704
|
const refresh = async () => {
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
return
|
|
20699
|
-
return new Promise(resolve => {
|
|
20700
|
-
(async () => {
|
|
20701
|
-
let url;
|
|
20702
|
-
try {
|
|
20703
|
-
url = await transformSource(node.src);
|
|
20704
|
-
} catch (e) {
|
|
20705
|
-
console.error(e);
|
|
20706
|
-
}
|
|
20707
|
-
const image = new Image();
|
|
20708
|
-
image.crossOrigin = props.crossOrigin;
|
|
20709
|
-
image.src = `${url}?=${new Date().getTime()}`; // 强制不缓存
|
|
20710
|
-
image.onload = () => {
|
|
20711
|
-
node.src = image.src;
|
|
20712
|
-
resolve(1);
|
|
20713
|
-
};
|
|
20714
|
-
image.onerror = () => resolve(0);
|
|
20715
|
-
})();
|
|
20716
|
-
});
|
|
20717
|
-
}));
|
|
20705
|
+
await vue.nextTick();
|
|
20706
|
+
snapdom.value = await snapDOM(current.value, props.options);
|
|
20707
|
+
return snapdom.value;
|
|
20718
20708
|
};
|
|
20719
20709
|
const toDataURL = async () => {
|
|
20720
20710
|
await refresh();
|
|
20721
|
-
return
|
|
20711
|
+
return snapdom.value.toRaw();
|
|
20722
20712
|
};
|
|
20723
20713
|
const download = async options => {
|
|
20724
20714
|
await refresh();
|
|
20725
|
-
const _download = VcInstance.options.Snapshot?.download || (() => false);
|
|
20726
|
-
const
|
|
20727
|
-
if (
|
|
20728
|
-
|
|
20729
|
-
|
|
20715
|
+
const _download = props.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
20716
|
+
const skip = _download(instance, options);
|
|
20717
|
+
if (skip && skip.then) {
|
|
20718
|
+
let skip$ = false;
|
|
20719
|
+
skip.then(v => {
|
|
20720
|
+
skip$ = typeof v === 'undefined' ? true : !!v;
|
|
20721
|
+
return v;
|
|
20722
|
+
}).finally(() => {
|
|
20723
|
+
skip$ || snapdom.value.download(options);
|
|
20730
20724
|
});
|
|
20731
20725
|
return;
|
|
20732
20726
|
}
|
|
20733
|
-
|
|
20727
|
+
skip || snapdom.value.download(options);
|
|
20734
20728
|
};
|
|
20735
20729
|
expose({
|
|
20736
|
-
|
|
20730
|
+
snapdom,
|
|
20737
20731
|
refresh,
|
|
20738
20732
|
toDataURL,
|
|
20739
20733
|
download
|
|
20740
20734
|
});
|
|
20741
20735
|
vue.onMounted(async () => {
|
|
20742
20736
|
try {
|
|
20743
|
-
|
|
20737
|
+
snapDOM = window.snapdom || (await Promise.resolve().then(() => snapdom$1));
|
|
20744
20738
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
20745
|
-
|
|
20739
|
+
await refresh();
|
|
20746
20740
|
emit('ready', {
|
|
20747
|
-
instance
|
|
20741
|
+
instance,
|
|
20748
20742
|
dependencies: {
|
|
20749
20743
|
snapDOM
|
|
20750
20744
|
}
|