zs-mini-ali-ui
Version:
中视编译后版本 ali-ui
205 lines (194 loc) • 5.91 kB
JavaScript
;/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 22:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
data: {
results: [],
items: [],
commonProps: {
max: 10000
}
},
didUnmount: function didUnmount() {
var _this$data = this.data,
items = _this$data.items,
results = _this$data.results;
results.splice(0, results.length);
items.splice(0, items.length);
}
});
/***/ })
/******/ });
/************************************************************************/
/******/ // 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 _mixins_lifecycle__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
Component({
mixins: [_mixins_lifecycle__WEBPACK_IMPORTED_MODULE_0__["default"]],
data: {
confirmStyle: ''
},
props: {
className: '',
item: '',
id: '',
value: '',
selected: false,
subtitle: '',
onChange: function onChange() {}
},
didMount: function didMount() {
var _this$data = this.data,
results = _this$data.results,
items = _this$data.items;
var _this$props = this.props,
selected = _this$props.selected,
id = _this$props.id,
value = _this$props.value;
if (selected) {
results.push({
id: id,
value: value
});
items.push({
id: id,
value: value,
setData: this.setData
});
this.setData({
confirmStyle: true
});
}
},
methods: {
handleClick: function handleClick() {
var _this$props2 = this.props,
id = _this$props2.id,
value = _this$props2.value,
onChange = _this$props2.onChange;
var confirmStyle = this.data.confirmStyle;
var _this$data2 = this.data,
results = _this$data2.results,
items = _this$data2.items,
commonProps = _this$data2.commonProps;
if (commonProps.max === 1) {
if (confirmStyle === '') {
items.forEach(function (element) {
element.setData({
confirmStyle: ''
});
});
results.splice(0, results.length);
confirmStyle = true;
results.push({
id: id,
value: value
});
items.push({
id: id,
value: value,
setData: this.setData
});
onChange(results);
}
this.setData({
confirmStyle: confirmStyle
});
return;
}
if (confirmStyle === '' && results.length < commonProps.max) {
confirmStyle = true;
results.push({
id: id,
value: value
});
items.push({
id: id,
value: value,
setData: this.setData
});
} else {
confirmStyle = '';
results.some(function (key, index) {
if (JSON.stringify(key) === JSON.stringify({
id: id,
value: value
})) {
results.splice(index, 1);
return true;
} else {
return false;
}
});
}
this.setData({
confirmStyle: confirmStyle
});
}
}
});
})();
/******/ })()
;