slider.wxs 640 B

12345678910111213141516171819202122232425
  1. var REGEXP = getRegExp('[$][{value}]{7}');
  2. function getValue(label, value) {
  3. if (label && label === 'true') return value;
  4. if (REGEXP.test(label)) return label.replace(REGEXP, value);
  5. }
  6. function getColor(disable, active, disabledColor, colors) {
  7. var index = active ? 0 : 1;
  8. if (disable && disabledColor.constructor === 'Array' && disabledColor.length == 2) {
  9. return 'background-color: ' + disabledColor[index];
  10. }
  11. if (!disable && colors.constructor === 'Array' && colors.length == 2) {
  12. return 'background-color: ' + colors[index];
  13. }
  14. return '';
  15. }
  16. module.exports = {
  17. getValue: getValue,
  18. getColor: getColor,
  19. };