简体   繁体   中英

Change the value of a bound property on an existing item in iron-list

I have an item bound in my iron-list , when I change a bound property on the object I am expecting to see the change reflected on the screen, but I don't. What am doing wrong?

https://jsfiddle.net/ckqL3a3o/3/

<link rel="import" href="https://cdn.rawgit.com/Download/polymer-cdn/1.2.3.2/lib/polymer/polymer.html">
<link rel="import" href="https://cdn.rawgit.com/Download/polymer-cdn/1.2.3.2/lib/iron-list/iron-list.html">
<script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
<script src="https://google.github.io/traceur-compiler/bin/BrowserSystem.js"></script>
<script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script>
<template is="dom-bind" id="app">
  <div style="width: 500px; height: 300px; background: #eee; overflow: auto; float:left">
    <iron-list items="{{data}}" as="item" style="width: 500px; height: 300px;">
      <template>
        <p><span>{{item.name}}</span> <span>{{item.value}}</span></p>
      </template>
    </iron-list>
  </div>
</template>
<script type="module">
    'use strict';

    var app = document.querySelector('#app');
        app.data = [{ name: 'item', value: 3 }];

    setTimeout(() => app.data[0].value = 4, 2000);
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM