编辑:这是来自 Appgyver/Steroids 团队的更好答案
根据您对用例的描述,我建议您在应用程序中预加载 show.html 一次,然后每当您需要显示 show.html 时,您将从您要移动的视图发送一条 postmessage 到show.html 它应该加载提供的 id 的内容。
如果您必须从远程服务器加载内容,您应该发送两个 postmessage,第一个包含您在前一页上已有的任何信息,这些信息将在 show.html 页面上使用。
我不知道我是否能够以最容易理解的方式解释这一点,但如果我的解释不清楚,请提出更多问题)原来这很容易:
下面我的解决方案的主要问题是创建大量 web 视图的内存问题
旧答案:for(var i =0; i
var webView = new steroids.views.WebView({location:"/views/cars/show.html? id="+id,id:id});
console.log(webView);
webView.preload({}, {
onSuccess: function() {
//steroids.layers.push(webView);
console.log('working');
}
});
}
然后使用另一个函数调用具有相同 id 的 webview:
$scope.open = function(id) {
var webView = new steroids.views.WebView({location:"/views/cars/show.html?id="+id,id:id});
steroids.layers.push(webView);
};