问题
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.
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.
Please help me
回答1:
Se this: 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.
This make it work great! Thanks to @tsonevn!
来源:https://stackoverflow.com/questions/49781789/nativescript-3-4-webview-on-ios-performance-is-slow