quanwei
2025-10-29 ea6deea758f1c7866c694f63a04730e86a463264
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;
  };
}