11<template >
2- <Button
3- :size =" size "
4- :text =" iconOnly ? ' ' : label "
5- :icon =" icon "
6- :iconOnly =" iconOnly "
7- :isLoading =" loading "
8- @click =" openCamera ? getFilesByCamera () : getFiles ()"
9- />
10- <ion-input
11- hidden
12- class =" d-none"
13- type =" file"
14- ref =" fileInput"
15- :multiple =" multiple"
16- :accept =" `${accept};capture=camera`"
17- @change =" filesChange"
18- />
2+ <div >
3+ <Button
4+ :size =" size "
5+ :text =" iconOnly ? ' ' : label "
6+ :icon =" icon "
7+ :iconOnly =" iconOnly "
8+ :isLoading =" loading "
9+ @click =" openCamera ? getFilesByCamera () : getFiles ()"
10+ />
11+ <ion-input
12+ hidden
13+ class =" d-none"
14+ type =" file"
15+ ref =" fileInput"
16+ :multiple =" multiple"
17+ :accept =" `${accept};capture=camera`"
18+ @change =" filesChange"
19+ />
20+ </div >
1921</template >
2022
2123<script >
@@ -75,7 +77,8 @@ export default {
7577 },
7678 methods: {
7779 getFiles () {
78- const fileInput = this .$refs .fileInput .$el .getElementsByTagName (' input' )[0 ];
80+ const fileInput =
81+ this .$refs .fileInput .$el .getElementsByTagName (' input' )[0 ];
7982 fileInput .click ();
8083 },
8184 async getFilesByCamera () {
@@ -89,13 +92,15 @@ export default {
8992 },
9093 dataUriToBlob (dataURI ) {
9194 const splitDataURI = dataURI .split (' ,' );
92- const byteString = splitDataURI[0 ].indexOf (' base64' ) >= 0
93- ? atob (splitDataURI[1 ])
94- : decodeURI (splitDataURI[1 ]);
95+ const byteString =
96+ splitDataURI[0 ].indexOf (' base64' ) >= 0
97+ ? atob (splitDataURI[1 ])
98+ : decodeURI (splitDataURI[1 ]);
9599 const mimeString = splitDataURI[0 ].split (' :' )[1 ].split (' ;' )[0 ];
96100
97101 const ia = new Uint8Array (byteString .length );
98- for (let i = 0 ; i < byteString .length ; i++ ) ia[i] = byteString .charCodeAt (i);
102+ for (let i = 0 ; i < byteString .length ; i++ )
103+ ia[i] = byteString .charCodeAt (i);
99104
100105 return new Blob ([ia], { type: mimeString });
101106 },
0 commit comments