File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -13,20 +13,19 @@ document.body.appendChild(container);
13
13
input . onchange = async ( ) : Promise < void > => {
14
14
try {
15
15
console . time ( "compress" ) ;
16
-
17
16
if ( ! input . files ) return ;
18
17
const blobs = await compress ( input . files , { useWebp : false } ) ;
19
18
console . timeEnd ( "compress" ) ;
20
19
// 显示成功
21
- document . body . append ( "压缩成功 " ) ;
20
+ container . append ( "compress success " ) ;
22
21
// 下载 blob
23
22
for ( let i = 0 ; i < blobs . length ; i ++ ) {
24
23
const blob = blobs [ i ] ;
25
24
const url = URL . createObjectURL ( blob ) ;
26
25
const a = document . createElement ( "a" ) ;
27
26
a . href = url ;
28
- a . download = `compressed-${ i } .${ blob . type . split ( "/" ) [ 1 ] } ` ;
29
- a . textContent = `下载 -${ i + 1 } ` ;
27
+ a . download = `compressed-${ i + 1 } .${ blob . type . split ( "/" ) [ 1 ] } ` ;
28
+ a . textContent = `download -${ i + 1 } ` ;
30
29
container . appendChild ( a ) ;
31
30
}
32
31
} catch ( error ) {
You can’t perform that action at this time.
0 commit comments