简体   繁体   中英

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. I am going to be redoing the webapp in polymer 3 and would like to know. 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('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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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