提交 5b9fd42b 编写于 作者: Q qiang

build v3

上级 d695c931
......@@ -10488,9 +10488,18 @@ var serviceContext = (function () {
measureText (text) {
const font = this.state.font;
let width = 0;
if (plus.os.name.toLowerCase() === 'ios') {
{
const webview = plus.webview.all().find(webview => webview.getURL().endsWith('www/__uniappview.html'));
width = Number(webview.evalJSSync(`(${measureText.toString()})(${JSON.stringify(text)},${JSON.stringify(font)})`));
if (webview) {
for (let index = 0; index < 5; index++) {
width = Number(webview.evalJSSync(`(${measureText.toString()})(${JSON.stringify(text)},${JSON.stringify(font)})`));
// 安卓部分情况会计算失败,进行重试
if (!isNaN(width)) {
width = 0;
break
}
}
}
}
return new TextMetrics(width)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册