在 Polymer 1 中动态引用绑定注解

Referencing binding annotations dynamically in Polymer 1

我正在尝试在 Polymer 1.0 中设置一个函数,它允许 JSON 响应告诉我的应用程序在哪个 {{BindingVariable}} 中插入响应。不幸的是,引用这些绑定变量的语法似乎类似于:this.BindingVariable,它不允许使用动态变量名称。

我真正需要的是一种动态引用这些的方法,就像我们可以引用 DOM/PolyDOM 中的任何其他内容一样。例如:document.querySelector('#'+elementID).

有什么方法可以动态引用绑定注解吗?我已经搜索了整个 Polymer DOM,但在任何地方都找不到它们,即使我知道它们在页面中。

例子

app._onResponseRetrieved = function(e) {
  for (var key in e.detail.response) {
    // none of these work, but they demonstrate what I'm trying to accomplish

    // this.key = e.detail.response[key];
    // this.querySelector(key) = e.detail.response[key];
    // window[key] = e.detail.response[key];
    // document[key] = e.detail.response[key];
    // Polymer.dom(key) = e.detail.response[key];
    }

JSON 发送到 _onResponseRetrieved

{"contactFormOutput":"Success!"}

index.html

中的绑定注解
<div>{{contactFormOutput}}</div>

this[key] = e.detail.response[key];

Javascript 允许 [] 在任何对象上动态 属性 引用