1
我试图通过对象数组使用聚合物1.0 <iron-ajax>一个DOM重复的内部
<template is="dom-repeat" as="plugin" items="{{plugins}}">
循环,并且然后为每个此数组中的对象的生成的URL来获取数据从。我想将这些数据放入页面。
我的元素看起来是这样的:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<script src="../../scripts/plugins.js"></script>
<dom-module id="sidenav-list">
\t <template>
\t \t <template is="dom-repeat" as="plugin" items="{{plugins}}">
\t \t \t <template is="dom-if" if="{{plugin.sidenav}}">
\t \t \t \t <iron-ajax auto url="{{_generatePluginUrl(plugin)}}" handle-as="text" last-response="{{plugin.ajax}}"></iron-ajax>
\t \t \t \t <html-echo html="{{plugin.ajax}}"></html-echo>
\t \t \t </template>
\t \t </template>
\t </template>
\t <script>
\t \t Polymer({
\t \t \t is: 'sidenav-list',
\t \t \t ready: function() {
\t \t \t \t this.plugins = allAddons();
\t \t \t },
\t \t \t _generatePluginUrl: function(plugin) {
\t \t \t \t var newURL = "./plugins/" + plugin.folder + "/" + plugin.file;
\t \t \t \t return newURL;
\t \t \t },
\t \t });
\t </script>
</dom-module>
的问题是,是我设置last-response="pluginAjax"
我结束了重复,当我把它设置为plugin.ajax
结果就是不确定的。
谢谢,精美的作品:d – Irontiga