Jie*_*Jie 5 javascript polymer
我想创建一个带有function属性的聚合物元素,在获得成功响应时会调用它.
<foo-bar url="/api/getdata" succCallback="func"></foo-bar>
func function(){
alert('hi');
}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
<polymer-element name="foo-bar" attributes="url succCallback">
<template>
<core-ajax id="ajax" method="POST"
url="{{url}}"
contentType="application/json"
handleAs="json"
on-core-response="{{handleResponse}}"></core-ajax>
</template>
<script>
Polymer({
handleResponse: function(e){
var response = e.detail.response;
if (response.status === 'success') {
// call succCallback
this.fire(succCallback);
}
}
});
</script>
</polymer-element>
Run Code Online (Sandbox Code Playgroud)
它不起作用.如何调用此succCallback函数?谢谢!
| 归档时间: |
|
| 查看次数: |
3264 次 |
| 最近记录: |