提交 d057df84 编写于 作者: X xiaoyucoding

fix: getImageInfo 返回 path 属性

上级 07d03bfc
import getRealPath from 'uni-platform/helpers/get-real-path'
function _getServiceAddress () {
return window.location.protocol + '//' + window.location.host
}
export function getImageInfo ({
src
}, callbackId) {
......@@ -5,11 +11,13 @@ export function getImageInfo ({
invokeCallbackHandler: invoke
} = UniServiceJSBridge
const img = new Image()
const realPath = getRealPath(src)
img.onload = function () {
invoke(callbackId, {
errMsg: 'getImageInfo:ok',
width: img.naturalWidth,
height: img.naturalHeight
height: img.naturalHeight,
path: realPath.indexOf('/') === 0 ? _getServiceAddress() + realPath : realPath
})
}
img.onerror = function (e) {
......@@ -18,4 +26,5 @@ export function getImageInfo ({
})
}
img.src = src
console.log(img)
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册