【问题标题】:Polymer does not work on IE 11 with template repeat generating an HTML tablePolymer 无法在 IE 11 上使用模板重复生成 HTML 表格
【发布时间】:2014-10-31 07:43:42
【问题描述】:

这个使用 Polymer 的 HTML 适用于 Chrome、IE 11 和 Firefox:

<polymer-element name="greeting-tag">
  <template>
      <template repeat="{{s in salutations}}">
        {{s.what}},{{s.who}}
      </template>             
  </template>
  <script>
    Polymer('greeting-tag', {
      ready: function() {
        this.salutations = [
          {what: 'Hello', who: 'World'},
          {what: 'GoodBye', who: 'DOM APIs'},
          {what: 'Hello', who: 'Declarative'},
          {what: 'GoodBye', who: 'Imperative'}
        ];
      }
    });
  </script>
</polymer-element>

但是当模板重复被替换为呈现 HTML 表格的代码时:

<polymer-element name="greeting-tag">
  <template>
    <table>
      <template repeat="{{s in salutations}}">
        <tr>
            <td>{{s.what}}</td>
            <td>{{s.who}}</td>
        </tr>
      </template>             
    </table>
  </template>
  <script>
    Polymer('greeting-tag', {
      ready: function() {
        this.salutations = [
          {what: 'Hello', who: 'World'},
          {what: 'GoodBye', who: 'DOM APIs'},
          {what: 'Hello', who: 'Declarative'},
          {what: 'GoodBye', who: 'Imperative'}
        ];
      }
    });
  </script>
</polymer-element>

它在 Chrome 和 Firefox 中有效,但它在 IE 11 中无效(根本不渲染元素)。有什么线索吗?

【问题讨论】:

    标签: html polymer


    【解决方案1】:

    好的,这个问题已经描述了here,这个可行:

    <polymer-element name="greeting-tag">
      <template>        
       <table>
         <tr template repeat="{{s in salutations}}">
           <td>{{s.what}}</td>
           <td>{{s.who}}</td>
         </tr>
       </table>     
      </template>
      <script>
        Polymer('greeting-tag', {
          ready: function() {
            this.salutations = [
              {what: 'Hello', who: 'World'},
              {what: 'GoodBye', who: 'DOM APIs'},
              {what: 'Hello', who: 'Declarative'},
              {what: 'GoodBye', who: 'Imperative'}
            ];
          }
        });
      </script>
    </polymer-element>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-01-10
      • 1970-01-01
      • 2015-06-26
      • 2019-01-04
      • 2020-06-05
      • 1970-01-01
      • 2021-08-03
      相关资源
      最近更新 更多