quanwei
2026-01-17 e1e2fe5710a5b5cd9c19bd3aa99c998a1a613ca8
1
2
3
4
5
6
7
8
9
10
11
12
/*封装获取远程JS返回的JSON数据*/
export const getJson = (url, func, callback) => {
  window[func] = function(data) {
    callback(data);
  };
  let script = document.createElement('script');
  script.setAttribute('src', url);
  document.getElementsByTagName('head')[0].appendChild(script);
  script.onload = script.onreadystatechange = function(data) {
    window[func] = null;
  };
}