index.wxs 1001 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* eslint-disable */
  2. function tabClass(active, ellipsis) {
  3. var classes = ['tab-class'];
  4. if (active) {
  5. classes.push('tab-active-class');
  6. }
  7. if (ellipsis) {
  8. classes.push('van-ellipsis');
  9. }
  10. return classes.join(' ');
  11. }
  12. function tabStyle(
  13. active,
  14. ellipsis,
  15. color,
  16. type,
  17. disabled,
  18. activeColor,
  19. inactiveColor,
  20. swipeThreshold,
  21. scrollable
  22. ) {
  23. var styles = [];
  24. var isCard = type === 'card';
  25. // card theme color
  26. if (color && isCard) {
  27. styles.push('border-color:' + color);
  28. if (!disabled) {
  29. if (active) {
  30. styles.push('background-color:' + color);
  31. } else {
  32. styles.push('color:' + color);
  33. }
  34. }
  35. }
  36. var titleColor = active ? activeColor : inactiveColor;
  37. if (titleColor) {
  38. styles.push('color:' + titleColor);
  39. }
  40. if (scrollable && ellipsis) {
  41. styles.push('flex-basis:' + 88 / swipeThreshold + '%');
  42. }
  43. return styles.join(';');
  44. }
  45. module.exports.tabClass = tabClass;
  46. module.exports.tabStyle = tabStyle;