index.js 768 B

12345678910111213141516171819202122232425262728293031
  1. Component({
  2. externalClasses: ['i-class'],
  3. relations: {
  4. '../collapse-item/index': {
  5. type: 'child'
  6. }
  7. },
  8. properties: {
  9. name: String,
  10. accordion: Boolean
  11. },
  12. methods: {
  13. clickfn(e) {
  14. const params = e.detail;
  15. const allList = this.getRelationNodes('../collapse-item/index');
  16. allList.forEach((item) => {
  17. if (params.name === item.data.name) {
  18. item.setData({
  19. showContent: 'i-collapse-item-show-content'
  20. });
  21. } else {
  22. item.setData({
  23. showContent: ''
  24. });
  25. }
  26. });
  27. },
  28. }
  29. });