uniappがuni.openDocumentを使用してファイルを開くと、アンドロイドが開くのに成功し、iOSが開くのに失敗しました.

1737 ワード

解決策:escapeを使用してファイル名を符号化する
uni.downloadFile({
                    url: url,
                    success: function(res) {
                        var filePath = res.tempFilePath;
                        //        doc, xls, ppt, pdf, docx, xlsx, pptx
                        uni.openDocument({
                            filePath: escape(filePath),
                            success: function(res) {
                                uni.hideLoading();
                                that.downloadFile_onoff = true;
                            },
                            fail() {
                                uni.showToast({
                                    title: '       ',
                                    duration: 2000
                                });
                                uni.hideLoading();
                                that.downloadFile_onoff = true;
                            }
                        }); 
                        
                        
                        
                    }
                });

 
転載先:https://www.cnblogs.com/lizhao123/p/11498948.html