index.js 960 B

123456789101112131415161718192021222324252627282930313233
  1. import baseComponent from '../helpers/baseComponent'
  2. import classNames from '../helpers/classNames'
  3. baseComponent({
  4. relations: {
  5. '../swipe-action/index': {
  6. type: 'descendant',
  7. observer() {
  8. this.debounce(this.updated)
  9. },
  10. },
  11. },
  12. methods: {
  13. updated() {
  14. const elements = this.getRelationNodes('../swipe-action/index')
  15. if (elements.length > 0) {
  16. elements.forEach((element, index) => {
  17. element.updated(index)
  18. })
  19. }
  20. },
  21. onCloseSwipe(current) {
  22. const elements = this.getRelationNodes('../swipe-action/index')
  23. if (elements.length > 0) {
  24. elements.forEach((element, index) => {
  25. if (current !== index) {
  26. element.onClose()
  27. }
  28. })
  29. }
  30. },
  31. },
  32. })