index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Component({
  2. externalClasses: ['i-class'],
  3. properties : {
  4. current : {
  5. type : Number,
  6. value : -1,
  7. observer : '_updateDataChange'
  8. },
  9. status : {
  10. type : String,
  11. //wait、process、finish、error
  12. value : ''
  13. },
  14. direction : {
  15. type : String,
  16. //value has horizontal or vertical
  17. value : 'horizontal'
  18. }
  19. },
  20. relations : {
  21. '../step/index' : {
  22. type : 'child',
  23. linked(){
  24. this._updateDataChange();
  25. },
  26. linkChanged () {
  27. this._updateDataChange();
  28. },
  29. unlinked () {
  30. this._updateDataChange();
  31. }
  32. }
  33. },
  34. methods: {
  35. _updateDataChange() {
  36. let steps = this.getRelationNodes('../step/index');
  37. const len = steps.length;
  38. if (len > 0) {
  39. steps.forEach((step, index) => {
  40. step.updateDataChange({
  41. len : len,
  42. index : index,
  43. current : this.data.current,
  44. direction : this.data.direction
  45. });
  46. });
  47. }
  48. }
  49. }
  50. })