NativeScript 3.4:iOS 上的 WebView 性能缓慢
NativeScript 3.4: WebView on iOS performance is Slow
当我在 NativeScript 3.4 和 4.0 的 WebView 中打开站点时,JavaScript 的性能很慢。在 Xcode 中构建时比普通 WKWebView 慢得多。
我也尝试过 NativeScript playground (play.nativescript.org),如果你放置一个 WebView 一个 运行 一个带有 JavaScript 的网站,它也会有缓慢的性能。
请帮帮我
看这个:github.
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!
当我在 NativeScript 3.4 和 4.0 的 WebView 中打开站点时,JavaScript 的性能很慢。在 Xcode 中构建时比普通 WKWebView 慢得多。
我也尝试过 NativeScript playground (play.nativescript.org),如果你放置一个 WebView 一个 运行 一个带有 JavaScript 的网站,它也会有缓慢的性能。
请帮帮我
看这个:github.
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!