UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

24 lines (21 loc) 534 B
import axios from 'axios'; /** * 获取天气信息 * @returns {Promise<Array>} 天气数据 * @example * * fetchWeatherData().then(content => { * console.log(content) * }) */ function fetchWeatherData() { return new Promise(function (resolve) { var QUERY_URL = 'https://weather.121.com.cn/data_cache/szWeather/alarm/szAlarm.json'; axios.get(QUERY_URL).then(function (res) { var _ref = res.data || {}, subAlarm = _ref.subAlarm; resolve(subAlarm); }); }); } export { fetchWeatherData };