首页 > 解决方案 > 从相机或图库上传图像

问题描述

我正在使用 Ionic 4。当我从相机或画廊上传图像时,我收到了 Type Script 错误。

我尝试了以下代码:

chooseImage() {
    let actionSheet = this.actionSheet.create({
        title: 'Choose Picture Source',
        buttons: [{
                text: 'Gallery',
                icon: 'albums',
                handler: () => {
                    this.actionHandler(1);
                }
            },
            {
                text: 'Camera',
                icon: 'camera',
                handler: () => {
                    this.actionHandler(2);
                }
            },
            {
                text: 'Cancel',
                role: 'cancel',
                handler: () => {
                    console.log('Cancel clicked');
                }
            }
        ]
    });
    actionSheet.present();
}

标签: ionic4

解决方案


推荐阅读