zs-mini-ali-ui
Version:
中视编译后版本 ali-ui
158 lines (151 loc) • 4.92 kB
JavaScript
;/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
/* 0 */,
/* 1 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ fmtEvent)
/* harmony export */ });
function fmtEvent(props, e) {
var dataset = {};
for (var key in props) {
if (/data-/gi.test(key)) {
dataset[key.replace(/data-/gi, '')] = props[key];
}
}
return Object.assign({}, e, {
currentTarget: {
dataset: dataset
},
target: {
dataset: dataset,
targetDataset: dataset
}
});
}
/***/ })
/******/ ]);
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _util_fmtEvent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
var SUPPORT_COMPONENT2 = my.canIUse('component2');
var TYPE_MAP = {
success: 'check_',
fail: 'close_',
cancel: 'close_',
info: 'help_',
warn: 'warn_',
waiting: 'time-5_'
};
Component({
props: {
className: '',
type: 'success',
title: '',
onTapMain: function onTapMain() {},
onTapSub: function onTapSub() {}
},
data: {
// message 的 icon 图标样式
iconType: 'check_',
// message 的 icon 类型(颜色)
iconType_: 'success'
},
onInit: function onInit() {
this.setType(this.props.type);
},
didMount: function didMount() {
if (!SUPPORT_COMPONENT2) {
this.setType(this.props.type);
}
},
didUpdate: function didUpdate(prevProps) {
if (!SUPPORT_COMPONENT2 && this.props.type !== prevProps.type) {
this.setType(this.props.type);
}
},
deriveDataFromProps: function deriveDataFromProps(nextProps) {
if (this.props.type !== nextProps.type) {
this.setType(nextProps.type);
}
},
methods: {
tapMain: function tapMain(e) {
var event = (0,_util_fmtEvent__WEBPACK_IMPORTED_MODULE_0__["default"])(this.props, e);
this.props.onTapMain(event);
},
tapSub: function tapSub(e) {
var event = (0,_util_fmtEvent__WEBPACK_IMPORTED_MODULE_0__["default"])(this.props, e);
this.props.onTapSub(event);
},
setType: function setType(type) {
var realType = TYPE_MAP[type] || 'check_'; // 根据 props 中的 type 值选择 icon 的图标以及颜色
this.setData({
iconType: realType,
iconType_: type
});
}
}
});
})();
/******/ })()
;