0

Is there a way to create a headless WebView instance in Nativescript (Vue) for use with nativescript-webview-interface (which expects a Nativescript view)? How can I instantiate the Vue component so it creates the native webview in the background (similar to document.createElement on web)?

4

1 回答 1

1

尝试创建元素的核心方式

import { WebView } from "tns-core-modules/ui/web-view";

...
methods: {
   createWebView: function() {
      const webView = new WebView();
      // Remember to pass in context in case of android
      wv._setupAsRootView({});
      wv.onLoaded();
      ...
   }
}
...
于 2018-12-04T17:18:56.313 回答