You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
image | 图片对象
ratio | 图片实际的宽高与容器宽高的比例
这两个属性你挂载的时机有问题,应该是获取图片成功后挂载
但是源码中
function ImgPlugin(instance) {
// 图片对象
let image = null
// 最终渲染宽高与图片实际宽高的比例
let ratio = 0
image | 图片对象
ratio | 图片实际的宽高与容器宽高的比例
这两个属性你挂载的时机有问题,应该是获取图片成功后挂载
但是源码中
function ImgPlugin(instance) {
// 图片对象
let image = null
// 最终渲染宽高与图片实际宽高的比例
let ratio = 0
}
function loadImage () {
utils.loadImage(opt.img)
.then((img) => {
image = img
imgActWidth = image.width
imgActHeight = image.height
init()
if (!isRefreshImage) {
_resolve()
}
})
.catch((e) => {
instance.observer.publish('IMG-LOAD-ERROR', e)
if (!isRefreshImage) {
_resolve()
}
})
}
你只是更新了保存的临时变量image ,并没有挂载到实例上去,希望确认下
The text was updated successfully, but these errors were encountered: