we-plugin / we-cropper

微信小程序图片裁剪工具
https://we-plugin.github.io/we-cropper/#/
MIT License
2.17k stars 450 forks source link

android选择图片后跳转到裁剪页面图片不能显示 #122

Open hua216 opened 5 years ago

hua216 commented 5 years ago

we-cropper 版本 1.3.7

对应工具或者iOS或者Andriod的版本号 android 9

微信版本号 7.0.4

重现步骤 upload () { wx.chooseImage({ count: 1, // 默认9 sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success (res) { const src = res.tempFilePaths[0]

    wx.navigateTo({
      url: `../crop/crop?src=${src}`
    })
  }
})

} 期待的行为 跳转到裁剪页面正常显示选择的图片

实际的行为 有时不能正常显示,需要滑动一下才能显示选择的图片 image

XinjianQi commented 5 years ago

我也遇到了,要手动点击屏幕缩放下才能显示,啥原因呢?

JunaYa commented 5 years ago

判断 device platform, 如果是 Android 平台,则再次操作添加图片路径

if (device.platform === 'android') { wecropper.pushOrigin(picturePath); }

floait commented 5 years ago

而且这个问题的出现不是百分百的, 有一定的几率是黑屏的

Phoenix0908 commented 5 years ago

我要遇到了同样的问题,概率性出现

star1921 commented 5 years ago

同样遇见了,小概率会出现,有解决方案吗?

Phoenix0908 commented 5 years ago

在 2019年8月8日,下午4:55,star1921 notifications@github.com 写道:

同样遇见了,小概率会出现,有解决方案吗?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/we-plugin/we-cropper/issues/122?email_source=notifications&email_token=AFAOJ7G4V7MVP3MLCIVYJXLQDPNRZA5CNFSM4HHWTLWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD326M2I#issuecomment-519431785, or mute the thread https://github.com/notifications/unsubscribe-auth/AFAOJ7BM4G6JLDCYND367QDQDPNRZANCNFSM4HHWTLWA.

我后来换了一个插件做

aaron-xue commented 4 years ago

在源码getImageInfo后.then里判断如果是安卓就再次调用self.updateCanvas()可解决问题

daizhejiaoliandemao commented 4 years ago

判断 device platform, 如果是 Android 平台,则再次操作添加图片路径

if (device.platform === 'android') { wecropper.pushOrigin(picturePath); }

问一下在哪里加啊? 求大神指点

JunaYa commented 4 years ago

在初始化 cropper 的时候 initCropper() { if (!wecropper) { wecropper = this.$refs.cropper; } wecropper.pushOrigin(this.url); if (device.platform === 'android') { wecropper.pushOrigin(this.url); } },

Phoenix0908 commented 4 years ago

我在初始化的时候加了这段,还是会偶现

chenxueling commented 4 years ago

感觉是华为手机会出现这个,在imageLoad 函数中判断是华为手机延迟300ms 调用self.updateCanvas() 好像可以避免