childs.js 548 B

123456789101112131415161718192021222324252627282930
  1. Component({
  2. properties: {
  3. list:{
  4. type:Object,
  5. observer:function(list){
  6. this.setData({ list });
  7. }
  8. },
  9. share:{
  10. type:Boolean,
  11. observer: function (share){
  12. this.setData({ share });
  13. }
  14. }
  15. },
  16. data: {
  17. list:[],
  18. share:false,
  19. scrollLeft:0,
  20. current:0
  21. },
  22. methods: {
  23. childChange(e){
  24. let index = e.currentTarget.dataset.index;
  25. this.setData({ current: index, scrollLeft: ((index - 1) * 90) });
  26. this.triggerEvent('getChildIndex', index );
  27. }
  28. }
  29. })