index.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. Component({
  2. /**
  3. * 组件的属性列表
  4. */
  5. externalClasses: ['l-class', 'l-class-icon','l-class-image', 'l-icon-class','l-image-class'],
  6. options: {
  7. multipleSlots: true // 在组件定义时的选项中启用多slot支持
  8. },
  9. properties: {
  10. count: {
  11. type: Number,
  12. value: 5
  13. },
  14. score:{
  15. type: Number,
  16. value: 0
  17. },
  18. size: {
  19. type: String,
  20. value: '36'
  21. },
  22. disabled: Boolean,
  23. activeColor: {
  24. type: String,
  25. value: '#FF5252'
  26. },
  27. inActiveColor: {
  28. type: String,
  29. value: '#FFE5E5'
  30. },
  31. name:{
  32. type:String,
  33. value:'favor-fill'
  34. },
  35. activeImage:String,
  36. inActiveImage:String
  37. },
  38. /**
  39. * 组件的初始数据
  40. */
  41. data: {
  42. },
  43. /**
  44. * 组件的方法列表
  45. */
  46. methods: {
  47. handleClick(e){
  48. if(this.data.disabled) return;
  49. const {index} = e.currentTarget.dataset;
  50. this.setData({
  51. score:index + 1
  52. });
  53. this.triggerEvent('linchange',{score:index+1});
  54. }
  55. }
  56. });