无头网页视图
Headless webview
有没有办法在 Nativescript (Vue) 中创建无头 WebView 实例以与 nativescript-webview-interface(需要 Nativescript 视图)一起使用?如何实例化 Vue 组件,以便它在后台创建本机 webview(类似于 Web 上的 document.createElement
)?
尝试创建元素的核心方式
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();
...
}
}
...
有没有办法在 Nativescript (Vue) 中创建无头 WebView 实例以与 nativescript-webview-interface(需要 Nativescript 视图)一起使用?如何实例化 Vue 组件,以便它在后台创建本机 webview(类似于 Web 上的 document.createElement
)?
尝试创建元素的核心方式
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();
...
}
}
...