index.wxs 848B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* eslint-disable */
  2. var utils = require('../wxs/utils.wxs');
  3. var style = require('../wxs/style.wxs');
  4. function pivotText(pivotText, percentage) {
  5. return pivotText || percentage + '%';
  6. }
  7. function rootStyle(data) {
  8. return style({
  9. 'height': data.strokeWidth ? utils.addUnit(data.strokeWidth) : '',
  10. 'background': data.trackColor,
  11. });
  12. }
  13. function portionStyle(data) {
  14. return style({
  15. background: data.inactive ? '#cacaca' : data.color,
  16. width: data.percentage ? data.percentage + '%' : '',
  17. });
  18. }
  19. function pivotStyle(data) {
  20. return style({
  21. color: data.textColor,
  22. right: data.right + 'px',
  23. background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color,
  24. });
  25. }
  26. module.exports = {
  27. pivotText: pivotText,
  28. rootStyle: rootStyle,
  29. portionStyle: portionStyle,
  30. pivotStyle: pivotStyle,
  31. };