ion-input类型文件仅适用于ios,不适用于android
问题描述:
我有这样的代码
<ion-input type="file" accept=".pdf,.doc,.docx" [(ngModel)]="data.files"></ion-input>
并且我在ios上尝试可以选择文件,但是为什么不能在android上工作呢?在android上没有错误,只是当我单击按钮时,视图有时向下滚动并向下滚动之前返回到上一个视图
and I try on ios it's work can choose file, but why not work on android? on android not have error, just when I click the button, the view scrolling down for sometimes and back to pervious view before scrolling down
答
Input type=file won't work on mobile. Here is the reference https://forum.ionicframework.com/t/upload-file-with-input-type-file-but-get-it-with-file-path/100043/2
您可以使用cordova插件,例如fileChooser,FilePicker-Phonegap-iOS-Plugin.
You can use cordova plugins like fileChooser, FilePicker-Phonegap-iOS-Plugin.