0
事情是這個對象名稱從數組列表中更改,我真的不明白我怎麼能綁定它們。我想從響應和profileIconId中提取id。這對一個用戶來說很簡單,但我有很多。預先感謝您的幫助!我有一個對象響應的鐵ajax,但名稱是動態的
這是我的代碼:
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="shared-styles.html">
<link rel="import" href="../bower_components/iron-ajax/iron-ajax.html">
<dom-module id="my-summoner">
<template>
<style>
:host {
display: block;
}
</style>
<iron-ajax
auto
url="[[_summonerName(name)]]"
handle-as="json"
last-response="{{names}}"></iron-ajax>
<h1>[[name]]</h1>
<span>{{names.~dynamic user name~.name}}</span>
</template>
<script>
Polymer({
is: 'my-summoner',
properties: {
name: {
type: String,
value: '',
notify: true
},
},
_summonerName: function(name){
return 'https://api.leagueofzabalt.club/summoner/by-name/' + name;
}
});
</script>
</dom-module>
這是響應:
{"lordfumeitor": {
"id": 19347567,
"name": "lord fumeitor",
"profileIconId": 1385,
"revisionDate": 1479073568000,
"summonerLevel": 30
}}