简体   繁体   English

如何使用铁阿贾克斯将项目从聚合物 1 更新为聚合物 3

[英]How to update a project using iron-ajax from polymer 1 to polymer 3

I have a webapp that I created in polymer 1 that uses iron-ajax to get data from the server.我有一个在聚合物 1 中创建的 web 应用程序,它使用 Iron-ajax 从服务器获取数据。 I am going to be redoing the webapp in polymer 3 and would like to know.我将在聚合物 3 中重做 webapp 并想知道。 Should I still use iron-ajax or is there a better resource to use?我应该仍然使用铁阿贾克斯还是有更好的资源可以使用?

iron-ajax已升级为聚合物 3,它与聚合物 3 一起使用效果很好,为什么要替换它

You can use native Fetch api您可以使用本机 Fetch api

fetch('http://example.com/movies.json')
  .then(function(response) {
    return response.json();
  })
  .then(function(myJson) {
    console.log(JSON.stringify(myJson));
  });

Or external libraries such as axios或外部库,如axios

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM