如何双向绑定铁输入到dom

编程入门 行业动态 更新时间:2024-10-22 09:47:32
本文介绍了如何双向绑定铁输入到dom-repeat的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我刚开始玩Polymer 1.0,我正在尝试对集合进行非常简单的绑定。我能够在dom-repeat中显示文本,但双向绑定到铁输入不起作用。 我尝试了一系列字符串和对象。没有运气。

I just started playing with Polymer 1.0 and am trying to do a very simple binding to collection. I am able to display text within dom-repeat, but the two-way binding to iron-input does not work. I tried array of strings, and objects. No luck.

<link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/iron-input/iron-input.html"> <dom-module id="hello-world"> <template> <ul> <template is="dom-repeat" items="{{data}}"> <li>{{item.value}}</li> </template> </ul> <ul> <template is="dom-repeat" items="{{data}}"> <li><input is="iron-input" bind-value="{{item.value}}"></input></li> </template> </ul> </template> </dom-module> <script> Polymer({ is: "hello-world", ready: function() { this.data = [ { value: "Hello" }, { value: "World!" } ]; } }); </script>

推荐答案

更改为: value = {{item.value :: input}} 请参阅此处: http ://plnkr.co/edit/QWdCk7ReXxtdKndwPdqq

更多推荐

如何双向绑定铁输入到dom

本文发布于:2023-08-02 11:30:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1277449.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:绑定   双向   dom

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!