Type '{ title: string; message: string; maximunImagesCount: number; outType: number; }' has no properties in common with type 'ImagePickerOptions'.
我不知道为什么会发生这种情况,之后有多个教程无济于事。我想知道是什么导致我这个问题以及如何解决。
这是代码。
choosePicture()
{
let option = {
title: 'Seleccione una imagen',
message: 'Seleccione 1 imagen',
maximunImagesCount: 1,
outType: 0
};
this.imagePicker.getPictures(option).then(results=> {
for(var i = 0 ; i< results.lenght; i++)
{
this.path = results[i];
alert("Gallery Path: " + results[i]);
}
},
err => {
alert("Error " + err);
})
}
答案 0 :(得分:0)
您必须将option
转换为ImagePickerOptions
choosePicture() {
let option : ImagePickerOptions = {
maximumImagesCount: 1
};
this.imagePicker.getPictures(option).then(results=> {
for(var i = 0 ; i< results.lenght; i++)
{
alert("Gallery Path: " + results[i]);
}
},
err => {
alert("Error " + err);
});
}
此外,您还必须像下面那样更改导入。
import { ImagePicker, ImagePickerOptions } from '@ionic-native/image-picker';
ImagePickerOptions仅具有以下5个属性