重构项目,方便开发
This commit is contained in:
24
frontend-vue/src/shared/bridges/pywebview.ts
Normal file
24
frontend-vue/src/shared/bridges/pywebview.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
export interface PywebviewApi {
|
||||
select_brand_xlsx_files?: () => Promise<string[]>
|
||||
select_brand_folder?: () => Promise<string | null>
|
||||
select_folder?: () => Promise<string | null>
|
||||
save_template_xlsx?: () => Promise<{ success: boolean; path?: string; error?: string }>
|
||||
save_template_zip?: () => Promise<{ success: boolean; path?: string; error?: string }>
|
||||
save_file_from_url?: (url: string, filename: string) => Promise<{ success: boolean; path?: string; error?: string }>
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
pywebview?: {
|
||||
api?: PywebviewApi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getPywebviewApi() {
|
||||
return window.pywebview?.api
|
||||
}
|
||||
|
||||
export function hasPywebview() {
|
||||
return Boolean(getPywebviewApi())
|
||||
}
|
||||
Reference in New Issue
Block a user