Javascript Polymer 1.0在<;模板>;dom重复

Javascript Polymer 1.0在<;模板>;dom重复,javascript,polymer,polymer-1.0,Javascript,Polymer,Polymer 1.0,我不知道如何从标记编辑绑定(变量) <template is="dom-repeat" items="{{ajaxResponse}}"> <script> var temp = {{item.title}}; //I want to do this {{item.title}} = temp.slice(1, 10); </script> <google-map-marker la

我不知道如何从标记编辑绑定(变量)

<template is="dom-repeat" items="{{ajaxResponse}}">
  <script>
        var temp = {{item.title}};
        //I want to do this
        {{item.title}} = temp.slice(1, 10);
  </script>      
  <google-map-marker latitude="{{item.lat}}" longitude="{{item.lng}}" title="{{item.title}}"> </google-map-marker>
</template>

var temp={{item.title};
//我想这样做
{{item.title}}=temp.slice(1,10);

提前感谢

如果您想更改ajax响应,最好通过响应上的
事件进行更改。
这没什么变化

<template is="dom-repeat" id="ironList" items="[]">
<google-map-marker latitude="{{item.lat}}" longitude="{{item.lng}}" title="  {{item.title}}"> </google-map-marker>
</template>
如果响应对象中有许多数组,则可以轻松使用循环。

可以使用循环

或者,如果您在
dombind
中,则可以在
模板
元素上定义该函数

<template is="dom-bind" id="app">
  ...
</template>

<script>
  document.getElementById('app').updateTitle= function (title) {
    return title.slice(1,10);
  };
</script>

...
document.getElementById('app').updateTitle=函数(标题){
返回标题。切片(1,10);
};
responseFunc: function(e) {
//receive all response data in array
var items = e.detail.response;
//perform your operations
var item = items[0]; 
var temp = item.title;
item.title = temp.slice(1, 10);
//add you changed data to template
this.$.ironList.push('items', item);
}
<google-map-marker title="[[updateTitle(item.title)]]"></google-map-marker>
Polymer({
  is: 'your-element',
  updateTitle: function (title) {
    return title.slice(1,10);
  }
});
<template is="dom-bind" id="app">
  ...
</template>

<script>
  document.getElementById('app').updateTitle= function (title) {
    return title.slice(1,10);
  };
</script>