index.wxs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. var containerStyle = function (urls, multipleSize, gapRow, gapColumn) {
  2. urls.length == 2 || urls.length == 4 ? 'width:' + (2 * multipleSize + gapRow) + 'rpx;' : 'width:' + (3 * multipleSize + 2 * gapRow) + 'rpx;'
  3. if (urls.length == 2 || urls.length == 4) {
  4. return 'width:' + (2 * multipleSize + gapRow) + 'rpx; grid-row-gap:' + gapColumn + 'rpx; grid-column-gap:' + gapRow + 'rpx;grid-template-columns:repeat(auto-fit, ' + multipleSize + 'rpx);'
  5. } else {
  6. return 'width:' + (3 * multipleSize + 2 * gapRow) + 'rpx; grid-row-gap:' + gapColumn + 'rpx; grid-column-gap:' + gapRow + 'rpx;grid-template-columns:repeat(auto-fit, ' + multipleSize + 'rpx);'
  7. }
  8. }
  9. var blockClass = function (urls, horizontalScreen) {
  10. if (urls.length == 1) {
  11. if (horizontalScreen) {
  12. return 'l-single-image-class'
  13. } else {
  14. return 'vertical l-single-image-class'
  15. }
  16. } else {
  17. return 'l-multi-image-class'
  18. }
  19. }
  20. var blockStyle = function (urls, horizontalScreen, shortSideValue, singleSize, multipleSize) {
  21. if (urls.length == 1) {
  22. if (horizontalScreen) {
  23. return 'height:' + shortSideValue + 'rpx;width:' + singleSize + 'rpx;'
  24. } else {
  25. return 'width:' + shortSideValue + 'rpx;height:' + singleSize + 'rpx;'
  26. }
  27. } else {
  28. return 'height:' + multipleSize + 'rpx;width:' + multipleSize + 'rpx;'
  29. }
  30. }
  31. module.exports = {
  32. containerStyle: containerStyle,
  33. blockClass: blockClass,
  34. blockStyle: blockStyle
  35. }