如何在Polymer 1.0中更新textarea和iron自动增长textarea文本值?

如何在Polymer 1.0中更新textarea和iron自动增长textarea文本值?,polymer,polymer-1.0,Polymer,Polymer 1.0,我在聚合物中设置了普通textarea双向绑定,使用: <textarea id="textbox" value="{{editText::input}}" autofocus></textarea> 属性editText分配如下: Polymer({ is: "page-editor", properties: { editText: { type: String, value: "" } }, 但是当在下面的代

我在聚合物中设置了普通
textarea
双向绑定,使用:

<textarea id="textbox" value="{{editText::input}}" autofocus></textarea> 
属性
editText
分配如下:

Polymer({
  is: "page-editor",
  properties: {
    editText: {
      type: String,
      value: ""
    }
  },
但是当在下面的代码中更改
editText
时,它不会更新相应的textarea值

this.editText = "new message";

有趣的是,console.log(this.editText)说它的“未定义”

我仍然在增加聚合物,但我认为需要将
notify
设置为
true

Polymer({
  is: "page-editor",
  properties: {
    editText: {
      type: String,
      value: "",
+     notify: true
    }
  },
...
如果这不起作用,发布一个完整的示例,我很乐意与您一起调试

您可以使用Polymer的
on-*
语法添加事件侦听器,其中
*
是要侦听的事件

<iron-autogrow-textarea bindValue="{{editText}}" 
                        class="fit" 
                        on-click="f' 
                        autofocus></iron-autogrow-textarea>

要使用的正确属性是
bind value=“{{editText}”
。CamelCase属性被转换为带有破折号()的属性。

Ah这是因为
this
来自一个按钮事件,所以它没有正确地引用“this”-有没有一个好的方法来处理这个问题?(双关语不是故意的)好的,所以我通过设置var
self=this得到了
textarea
工作并使用self.editText更改文本。。。但是
iron autogrow textarea
不能使用双重绑定-我是否遗漏了什么?请参阅更新的答案。再说一次,我对这方面还不熟悉,所以请接受我的帮助。如果你也发布了完整的示例,那就容易多了。我接受这个作为“iron autogrow textarea”双向绑定的解决方案。通过使用连字符属性-
<iron-autogrow-textarea bindValue="{{editText}}" 
                        class="fit" 
                        on-click="f' 
                        autofocus></iron-autogrow-textarea>
Polymer({
  is: "page-editor",
  properties: {
    editText: {
      type: String,
      value: "",
      notify: true
    }
  },
  /* the function signature below may be wrong...
   * don't know how many arguments it takes... */
  f: function(e, detail, sender) {
    this.editText = 'yay';
  }
...