UNPKG

iweather_icon_weapp

Version:
180 lines (168 loc) 3.16 kB
var globalThis = this, self = this; module.exports = require("../_commons/0.js")([ { "ids": [1], "modules":{ /***/ 1: /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(23) /***/ }), /***/ 23: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // CONCATENATED MODULE: ./src/components/i-icon/utils.ts var isWarning = function isWarning(i) { return /^warnings-/.test(i); }; var qweatherIcon = function qweatherIcon(i) { if (isWarning(i)) { return i.replace('warnings-', ''); } return i; }; var caiyunWarningsMap = { '01': '1001', //台风 '02': '1003', // 暴雨 '03': '1004', // 暴雪 '04': '1005', // 寒潮 '05': '1006', // 大风 '06': '1007', // 沙尘暴 '07': '1009', // 高温 '08': '1022', // 干旱 '09': '1014', // 雷电 10: '1015', // 冰雹 11: '1016', // 霜冻 12: '1017', // 大雾 13: '1019', // 霾 14: '1021', // 道路结冰 15: '1025', // 森林火险 16: '1020', // 雷雨大风 17: '1047', // 春季沙尘天气趋势预警 18: '1051' // 沙尘 }; var caiyunWarnings = function caiyunWarnings(code) { return caiyunWarningsMap[code]; }; var caiyunIconsMap = { 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', CLEAR_DAY: '100', // 晴 CLEAR_NIGHT: '150', // 晴 PARTLY_CLOUDY_DAY: '101', // 多云 PARTLY_CLOUDY_NIGHT: '151', // 多云 CLOUDY: '104', // 阴 LIGHT_HAZE: '502', // 轻度雾霾 MODERATE_HAZE: '511', // 中度雾霾 HEAVY_HAZE: '512', // 重度雾霾 LIGHT_RAIN: '305', // 小雨 MODERATE_RAIN: '306', // 中雨 HEAVY_RAIN: '307', // 大雨 STORM_RAIN: '310', // 暴雨 FOG: '501', // 雾 LIGHT_SNOW: '400', // 小雪 MODERATE_SNOW: '401', // 中雪 HEAVY_SNOW: '402', // 大雪 STORM_SNOW: '403', // 暴雪 DUST: '504', // 浮尘 SAND: '507', // 沙尘 WIND: '1006' // 大风 }; var caiyunIcons = function caiyunIcons(i) { return caiyunIconsMap[i]; }; var caiyunIcon = function caiyunIcon(i) { if (isWarning(i)) { return caiyunWarnings(i.replace('warnings-', '')); } return caiyunIcons(i); }; // CONCATENATED MODULE: ./src/components/i-icon/index.ts Component({ properties: { name: { type: String }, size: { type: Number, optionalTypes: [String], value: 18 }, type: { type: String, value: 'qweather' } }, lifetimes: { attached: function attached() { var _this$properties = this.properties, type = _this$properties.type, name = _this$properties.name; var prefix = ''; if (isWarning(name)) { prefix = 'warnings'; } else { prefix = 'weathers'; } var id = ''; if (type === 'qweather') { id = qweatherIcon(name); } else if (type === 'caiyun') { id = caiyunIcon(name); } this.setData({ id: "".concat(prefix, "-").concat(id) }); } }, data: { id: '' } }); /***/ }) }, "entries": [[1,0]] }, ]);