Ingen beskrivning

utils-9c8fdacf.js 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-3469b70d.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 exportStyleSizeClass(styles, size) {
  27. return _rollupPluginBabelHelpers._defineProperty({}, styles[size], true);
  28. }
  29. exports.addImageProcess = addImageProcess;
  30. exports.exportStyleSizeClass = exportStyleSizeClass;
  31. //# sourceMappingURL=utils-9c8fdacf.js.map