如何使用 iron-ajax 将项目从聚合物 1 更新为聚合物 3

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

我有一个在 polymer 1 中创建的网络应用程序,它使用 iron-ajax 从服务器获取数据。我将在 polymer 3 中重做 webapp 并且想知道。我还应该使用 iron-ajax 还是有更好的资源可以使用?

您可以使用native Fetch api

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

或外部库如axios

iron-ajax 已经升级到 polymer 3,它和 polymer 3 一起工作很好 为什么要替换它