index.js 729 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Component({
  2. relations: {
  3. '../grid/index': {
  4. type: 'parent'
  5. },
  6. },
  7. externalClasses: ['l-grid-item', 'l-grid-item-class'],
  8. properties: {
  9. key: String,
  10. cell:{
  11. type:Object,
  12. value:{}
  13. },
  14. },
  15. data: {
  16. index:0,
  17. },
  18. attached() {
  19. },
  20. observers: {
  21. 'key': function() {
  22. const parent = this.getRelationNodes('../grid/index')[0];
  23. if (parent) {
  24. parent.setData({
  25. gridItems: [],
  26. childNum: 0
  27. });
  28. parent.initGrids();
  29. }
  30. }
  31. },
  32. lifetimes: {
  33. show() {
  34. },
  35. },
  36. methods: {
  37. tapGridItem() {
  38. this.triggerEvent('linitemtap', {
  39. ...this.data
  40. }, { bubbles: true, composed: true });
  41. },
  42. }
  43. });