收藏
回答

H5内嵌小程序使用chooseImage选择图片成功后页面直接跳转到首页?

荣耀magic 2手机

async chooseImage(){
    let ShopID = await getMallShopId();
    await GetConfigOfWXSDK({
        'filter': JSON.stringify({
            ShopID: ShopID,
            Url: encodeURIComponent(location.href.split('#')[0])
        })
    }).then(res => {
        wx.config({
            debug: false,
            appId: res.appId,
            timestamp: res.timestamp,
            nonceStr: res.nonceStr,
            signature: res.signature,
            jsApiList: [
                'chooseImage'
            ]
        });
        wx.ready(() => {
            wx.chooseImage({
                count: 1,
                sizeType: ['original'],
                sourceType: ['album', 'camera'],
                success(res) {
                    // tempFilePath可以作为img标签的src属性显示图片
                    alert('成功')
                    console.log(res)
                },
                fail(err) {
                    alert('失败')
                    console.log(err)
                },
            })
        })
    })
},
回答关注问题邀请回答
收藏

1 个回答

  • 阿瑶吖ღ
    阿瑶吖ღ
    2020-06-04

    问题已经解决。

    2020-06-04
    有用
    回复 1
    • BigSong
      BigSong
      2020-06-22
      您好,请问怎么解决的
      2020-06-22
      回复
登录 后发表内容
问题标签