Ionic5的工程项目,前端使用Angular,需要使用File插件,根据官网上的提示,分别执行以下两条语句
ionic cordova plugin add cordova-plugin-file
npm install @ionic-native/file
然后按照示例代码
import { File } from '@ionic-native/file/ngx';
constructor(private file: File) { }
鼠标如果放在File上提示下面
interface File
Provides information about files and allows JavaScript in a web page to access their content.
如果鼠标放在Import的File上提示
(alias) const File: FileOriginal
import File
'File' is declared but its value is never read.ts(6133)
后来找了一番资料,发现写法要做一些改变,import要改为下面,用as转换下,