收藏
回答

wx.showShareImageMenu 点击保存到相册提示暂无权限如何能在点击保存到相册时获取?

wx.showShareImageMenu() 点击保存到相册提示暂无权限 如何能在点击保存到相册时获取权限?

代码

wx.canvasToTempFilePath({

canvasId: 'shareCanvas',

x: 0,

y: 0,

width: this.canvasW,

height: this.canvasH,

destWidth: this.canvasW * 2,

destHeight: this.canvasH * 2,

quality: 1.0,

success: (res) => {

// 调起分享菜单

wx.showShareImageMenu({

path: res.tempFilePath,

success: () => {

uni.showToast({

title: '分享入口已打开',

icon: 'success'

});

},

fail: (err) => {

console.error('调起分享菜单失败:', err);

uni.showToast({

title: '如果点击保存相册,请先前往右上角设置打开相册权限',

icon: 'none'

});

},

complete: () => {

this.isLoading = false;

}

});

},

fail: (err) => {

console.error('生成临时图片失败:', err);

uni.showToast({

title: '图片生成失败',

icon: 'none'

});

this.isLoading = false;

}

}, this);

});

最后一次编辑于  01-20
回答关注问题邀请回答
收藏

3 个回答

  • 社区技术运营专员--阳光
    社区技术运营专员--阳光
    01-20

    报错截图看看

    01-20
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    01-20
    有用
    回复
  • Wan
    Wan
    01-20

    wx.canvasToTempFilePath({

    canvasId: 'shareCanvas',

    x: 0,

    y: 0,

    width: this.canvasW,

    height: this.canvasH,

    destWidth: this.canvasW * 2,

    destHeight: this.canvasH * 2,

    quality: 1.0,

    success: (res) => {

    // 调起分享菜单

    wx.showShareImageMenu({

    path: res.tempFilePath,

    success: () => {

    uni.showToast({

    title: '分享入口已打开',

    icon: 'success'

    });

    },

    fail: (err) => {


    console.error('调起分享菜单失败:', err.errMsg);

    // uni.showToast({

    // title: '分享失败,请重试',

    // icon: 'none'

    // });

    },

    complete: () => {

    this.isLoading = false;

    }

    });

    },

    01-20
    有用
    回复
登录 后发表内容