index.wxs 747B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* eslint-disable */
  2. var style = require('../wxs/style.wxs');
  3. var addUnit = require('../wxs/add-unit.wxs');
  4. function isImage(name) {
  5. return name.indexOf('/') !== -1;
  6. }
  7. function rootClass(data) {
  8. var classes = ['custom-class'];
  9. if (data.classPrefix != null) {
  10. classes.push(data.classPrefix);
  11. }
  12. if (isImage(data.name)) {
  13. classes.push('van-icon--image');
  14. } else if (data.classPrefix != null) {
  15. classes.push(data.classPrefix + '-' + data.name);
  16. }
  17. return classes.join(' ');
  18. }
  19. function rootStyle(data) {
  20. return style([
  21. {
  22. color: data.color,
  23. 'font-size': addUnit(data.size),
  24. },
  25. data.customStyle,
  26. ]);
  27. }
  28. module.exports = {
  29. isImage: isImage,
  30. rootClass: rootClass,
  31. rootStyle: rootStyle,
  32. };