Geen omschrijving

utils-ed518bfc.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. var _commonjsHelpers = require('./_commonjsHelpers-4ed3570f.js');
  3. var IMAGE_PROCESS = '?x-oss-process=image/resize,h_350';
  4. var IMAGE_PROCESS_SMALL = '?x-oss-process=image/resize,h_100';
  5. var IMAGE_PROCESS_LARGE = '?x-oss-process=image/resize,h_500';
  6. function addImageProcess(url) {
  7. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
  8. width: '36px',
  9. height: '36px'
  10. };
  11. // 防止重复添加导致的url不正确
  12. if (url && url.indexOf('x-oss-process') > -1) {
  13. return url;
  14. }
  15. if (options.small) {
  16. return url + IMAGE_PROCESS_SMALL;
  17. }
  18. if (options.large) {
  19. return url + IMAGE_PROCESS_LARGE;
  20. }
  21. if (options.custom) {
  22. return "".concat(url, "?x-oss-process=image/resize,limit_0,m_fill,w_").concat(options.width, ",h_").concat(options.height);
  23. }
  24. return url + IMAGE_PROCESS;
  25. }
  26. function formatMoney(input) {
  27. var fuzz = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  28. if (isNaN(+input)) {
  29. return input;
  30. }
  31. return (+input).toFixed(fuzz);
  32. }
  33. function exportStyleSizeClass(styles, size) {
  34. return _commonjsHelpers._defineProperty({}, styles[size], true);
  35. }
  36. exports.addImageProcess = addImageProcess;
  37. exports.exportStyleSizeClass = exportStyleSizeClass;
  38. exports.formatMoney = formatMoney;
  39. //# sourceMappingURL=utils-ed518bfc.js.map