mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-11 02:20:08 +00:00
Implement color palette in Vue (#2047)
Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
@@ -110,11 +110,7 @@ export async function addStylesheet(
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* @param { string } filename
|
||||
* @param { Blob } blob
|
||||
*/
|
||||
export function downloadBlob(filename, blob) {
|
||||
export function downloadBlob(filename: string, blob: Blob) {
|
||||
const url = URL.createObjectURL(blob)
|
||||
const a = $el('a', {
|
||||
href: url,
|
||||
@@ -129,6 +125,20 @@ export function downloadBlob(filename, blob) {
|
||||
}, 0)
|
||||
}
|
||||
|
||||
export function uploadFile(accept: string) {
|
||||
return new Promise<File>((resolve, reject) => {
|
||||
const input = document.createElement('input')
|
||||
input.type = 'file'
|
||||
input.accept = accept
|
||||
input.onchange = (e) => {
|
||||
const file = (e.target as HTMLInputElement).files?.[0]
|
||||
if (!file) return reject(new Error('No file selected'))
|
||||
resolve(file)
|
||||
}
|
||||
input.click()
|
||||
})
|
||||
}
|
||||
|
||||
export function prop<T>(
|
||||
target: object,
|
||||
name: string,
|
||||
|
||||
Reference in New Issue
Block a user