所以,我有一个简单的聚合物应用程序,其中包含列出一些用户的页面和用户详细信息页面.
我在列表页面使用firebase-query,在详细信息页面使用firebase-document.
我正在使用app-route为用户详细信息页面传递用户的id
<app-route route="{{route}}" pattern="/:key" data="{{routeData}}"></app-route>
<firebase-document path="/users/[[routeData.key]]" data="{{person}}"></firebase-document>
{{person.name}}<br />
{{person.email}}<br />
Run Code Online (Sandbox Code Playgroud)
到目前为止,详细信息页面读取正确的文档,数据绑定工作正常.
但是,让我们说"John"有一封电子邮件,但"Bob"没有.如果我从列表页面开始并单击"John",则详细信息页面会显示John的名称和电子邮件.
然后我回到列表页面,然后点击"Bob".详细信息页面显示了Bob的名称,但它显示了John的电子邮件.
换句话说,如果属性为空,它将记住最后一个人加载的属性.
我怎么能以某种方式重置所有内容,以便我不会获得属于另一个用户的值?
我正在使用 preprocess_views_view 来定义一些新变量并将它们传递给树枝模板。
为了定义这些变量,我需要访问公开的过滤器输入值,但我似乎无法弄清楚如何:
function my_modules_preprocess_views_view(&$variables) {
$view = $variables['view'];
// Here I would need to access the exposed filters value
$exposed_filter_value = "the_value";
$variables["foo"] = "Something based on the exposed filters value";
}
Run Code Online (Sandbox Code Playgroud)
我将非常感谢任何线索 - 干杯!