0
私はapp-routeのパラメータをundefinedに移動しました。私はそのパラメータをファイルに表示することができますが、カスタム要素では定義されていません。以下は私のコードであり、それを修正する方法を調べるのを助けてください。ありがとう。ポリマーがカスタム要素へのapp-routeのデータを渡していません
カスタム要素ファイルで、getid
が不定になりました。
マイファイル
<app-route
route="[[route]]"
pattern="/:slug/:id"
data="{{routeData}}"></app-route>
<!-- display correctly -->
[[routeData.id]]
<myelement-http-get
id="getCategoryData"
getid="[[routeData.id]]"
geturl="http://localhost:9000/polymer/category/"
jsonobject="{{jsonobject}}"
failure="{{failure}}"></myelement-http-get>
カスタム要素それはないですので、あなたがそれらのプロパティを操作したいと思いますどこgetid
とgeturl
ための効果は、ready
コールバックした後が起こるの結合
<script>
Polymer({
is: 'myelement-http-get',
properties: {
geturl: String,
getid: String,
jsonobject: {
type: Object,
notify: true
},
failure: {
type: Boolean,
notify: true,
readOnly: true
}
},
ready: function() {
/* undefined found this.getid */
this.$.ajaxData.url = this.geturl + this.getid;
this.$.ajaxData.generateRequest();
},
handleResponse: function (data) {
this.jsonobject = data.detail.response;
}
});
</script>
おかげで、それは部分的に正しいです。オブザーバー:['_generateRequest(geturl、getid)']、 '3番目のページを取得したときに更新できません。 'geturl'は常に第2ページのURLを表示します。 – ppshein