0
我正在製作一個自定義元素以顯示來自亞音速服務器的專輯封面牆。當聲明元素將查詢服務器並獲得200響應。該響應將正確地登錄到控制檯中。但在瀏覽器中沒有呈現任何內容。錯誤顯示core-ajax自定義元素
<link rel="import" href="../bower_components/core-ajax/core-ajax.html">
<link rel="import" href="album-info-big-art.html">
<polymer-element name="albums-wall" attributes="url">
<template>
<core-ajax auto url="{{url}}" handleAs="json" response="{{response}}"></core-ajax>
<template id='albums' repeat="{{response.subsonic-response.albumList2.album}}">
<album-info-big-art artist='{{artist}}' title='{{name}}' img='{{coverArt}}'></album-info-big-art>
</template>
</template>
<script>
Polymer('albums-wall',{
responseChanged: function(e) {
var albums = this.response;
console.log(albums);
}
});
</script>
</polymer-element>
響應看起來像。
Object {subsonic-response: Object}
subsonic-response: Object
albumList2: Object
album: Array[60]
__proto__: Object
status: "ok"
version: "1.10.2"
xmlns: "http://subsonic.org/restapi"
__proto__: Object
__proto__: Object
我很確定我錯過了js部分的內容。
我試着用Github API調用你的代碼來列出我的倉庫。它運行良好。你確定你的網址是正確的嗎?也許你需要某種認證?請求是否發送到服務器?你沒有得到任何迴應,或者你得到了200迴應,但瀏覽器中沒有顯示任何內容?瀏覽器開發控制檯中是否記錄了任何錯誤? –
該網址是正確的。並且響應按預期返回數據。在控制檯中也沒有錯誤。 –