index.wxs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* eslint-disable */
  2. var pxCheck = require('../wxs/pxCheck.wxs');
  3. var style = require('../wxs/style.wxs');
  4. function Classes(data) {
  5. var prefixCls = 'nut-button'
  6. var classes = [prefixCls]
  7. if (data.type) {
  8. classes.push(prefixCls + '--' + data.type)
  9. }
  10. if (data.size) {
  11. classes.push(prefixCls + '--' + data.size)
  12. }
  13. if (data.shape) {
  14. classes.push(prefixCls + '--' + data.shape)
  15. }
  16. if (data.plain) {
  17. classes.push(prefixCls + '--plain')
  18. }
  19. if (data.block) {
  20. classes.push(prefixCls + '--block')
  21. }
  22. if (data.disabled) {
  23. classes.push(prefixCls + '--disabled')
  24. }
  25. if (data.loading) {
  26. classes.push(prefixCls + '--loading')
  27. }
  28. return classes.join(' ');
  29. }
  30. function Styled(data) {
  31. var styley = {};
  32. if (data.color) {
  33. console.log(data)
  34. if (data.plain) {
  35. styley.color = data.color;
  36. styley.background = '#fff';
  37. if (data.color.indexOf('gradient') == -1) {
  38. styley.borderColor = data.color;
  39. }
  40. } else {
  41. styley.color = '#fff';
  42. styley.background = data.color;
  43. }
  44. }
  45. return style([styley]);
  46. }
  47. module.exports = {
  48. classes: Classes,
  49. styled: Styled
  50. };