我使用React + Redux創建了一個新的漸進式Web應用程序。網絡應用程序應在網格視圖中顯示設備(智能手機)的本地圖像。 (類似於本地圖庫應用程序)。在啓動Web應用程序時加載本地文件
我想要創建一個新的Javascript函數從智能手機獲取圖像作爲JSON。這是我的行動,這應運行:
export const getImages =() => {
return {
type: 'GET_IMAGES',
images: loadImages()
}
};
function loadImages() {
//Retrieve all the images from local storage
}
我已經尋找可能的解決方案,並發現fileAPI。但我不知道,如果可以將其用於此用例,或者由於PWA服務人員可能會有更好的解決方案。
哪個檔案API你是指什麼?請提供參考。 – oklas
https://www.w3.org/TR/file-upload/ 更好地描述在這裏:https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications –