index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // components/diy-tabs/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. },
  8. /**
  9. * 组件的初始数据
  10. */
  11. data: {
  12. style: {
  13. activebgColor: "#fff",
  14. activeHeight: 88 / 2,
  15. activeColor: "#E43F81 !important",
  16. activePadding: 40 / 2,
  17. tabsHeight: 40,
  18. tabsBackground: "linear-gradient(270deg, #E74B77 0%, #EC355C 100%)",
  19. selectedX: 10,
  20. selectedY: 10,
  21. tabBorderRadius: 12,
  22. tabFontSize: 14,
  23. tabColor: "#fff;",
  24. tabMarginLeft: 20,
  25. },
  26. selected: 0,
  27. scrollItem: [
  28. {
  29. id: 0,
  30. name: "全部"
  31. },
  32. {
  33. id: 1,
  34. name: "面部护理"
  35. },
  36. {
  37. id: 2,
  38. name: "精致彩妆"
  39. },
  40. {
  41. id: 3,
  42. name: "迷人香水"
  43. },
  44. {
  45. id: 4,
  46. name: "洗发护发"
  47. }
  48. ]
  49. },
  50. /**
  51. * 组件的方法列表
  52. */
  53. methods: {
  54. selected(e) {
  55. console.log(e);
  56. let id = e.currentTarget.dataset.item;
  57. this.setData({
  58. selected: id,
  59. });
  60. },
  61. }
  62. })