zs-mini-ali-ui
Version:
中视编译后版本 ali-ui
162 lines (149 loc) • 5.19 kB
JavaScript
;/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 4:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (/* binding */ fmtUnit)
/* harmony export */ });
var jsUnitRpx = 'false';
/* eslint-disable no-continue, prefer-spread */
function fmtUnit(oldUnit) {
var getUnit = oldUnit;
if (jsUnitRpx === 'true') {
if (typeof getUnit === 'string' && getUnit === 'px') {
getUnit = 'rpx';
} else if (typeof getUnit === 'number') {
getUnit *= 2;
} else if (typeof getUnit === 'string') {
getUnit = oldUnit.match(/(\d+|\d+\.\d+)(px)/)[1] * 2 + 'rpx';
}
}
return getUnit;
}
/***/ })
/******/ });
/************************************************************************/
/******/ // 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_fmtUnit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4);
Component({
props: {
infinite: false,
className: '',
fillColor: '#ddd',
frontColor: '#1677FF',
pagerName: '',
height: (0,_util_fmtUnit__WEBPACK_IMPORTED_MODULE_0__["default"])('100px'),
white: false,
max: 5,
currentPage: 1,
current: 0,
// 兼容 mini-antui 而添加的属性
total: 0 // 兼容 mini-antui 而添加的属性
},
didMount: function didMount() {
this.compatAntui();
},
didUpdate: function didUpdate() {
this.compatAntui();
},
methods: {
compatAntui: function compatAntui() {
// 兼容 mini-antui 升级到 mini-ali-ui 后分页符的页数使用
var _this$props = this.props,
current = _this$props.current,
total = _this$props.total;
if (current !== 0 || total !== 0) {
this.setData({
currentPage: current,
max: total
});
}
},
clacWidth: function clacWidth(pagerName) {
var _this = this;
my.createSelectorQuery().select("#" + pagerName).boundingClientRect().exec(function (ret) {
if (ret && ret[0]) {
_this.wrapWidth = ret[0].width;
}
});
return this.wrapWidth;
},
onScroll: function onScroll(e) {
var infinitePageNumber = {};
var _e$detail = e.detail,
scrollLeft = _e$detail.scrollLeft,
scrollWidth = _e$detail.scrollWidth;
var viewWidth = this.clacWidth(e.currentTarget.dataset.id);
if (viewWidth) {
infinitePageNumber[e.currentTarget.dataset.id] = {
pageDeg: Math.ceil(scrollLeft / (scrollWidth - viewWidth) * 100)
};
this.setData({
pageDeg: infinitePageNumber[e.currentTarget.dataset.id].pageDeg
});
}
}
}
});
})();
/******/ })()
;