NativeScript 3.4:iOS上的WebView性能缓慢 [英] NativeScript 3.4: WebView on iOS performance is Slow

查看:84
本文介绍了NativeScript 3.4:iOS上的WebView性能缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在NativeScript 3.4和更高版本的WebView中打开网站时, 4.0 JavaScript的性能很慢.在Xcode中构建时,速度比普通的WKWebView慢得多.

When I open an site in the WebView on NativeScript 3.4 & 4.0 the performance of the JavaScript is slow. Much much slower then normal WKWebView when build in Xcode.

我还尝试了NativeScript运动场( play.nativescript.org ),如果您放置了WebView使用JavaScript运行某些网站也会降低性能.

I have also tried the NativeScript playground (play.nativescript.org) and if you place out an WebView an run an some site with JavaScript it also have slow performance.

请帮助我

推荐答案

此:

该问题可能与设置为 配置站点的初始规模.就测试而言,我建议 打开node_modules/tns-core-modules/ui/web-view/web-view-ios.js和 替换var jScript ="var meta = document.createElement('meta'); meta.setAttribute('name','viewport'); meta.setAttribute('content', '初始比例= 1.0'); document.getElementsByTagName('head')[0] .appendChild(meta);;-> var jScript ="然后尝试再次构建项目tns运行ios并检查 如果JavaScript将再次缓慢执行.

The issue might be related to the JavaScript which is set up to config the site's initial-scale.Just for the test I would suggest opening node_modules/tns-core-modules/ui/web-view/web-view-ios.js and replace var jScript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'initial-scale=1.0'); document.getElementsByTagName('head')[0].appendChild(meta);"; -> var jScript = "" then try to build the project again tns run ios and check if the javascript will be executed slowly again.

这使它工作起来很棒!感谢@tsonevn!

This make it work great! Thanks to @tsonevn!

这篇关于NativeScript 3.4:iOS上的WebView性能缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆