Transfer List

传输列表允许用户在列表之间移动一个或多个列表项。

使用

  1. <script src="https://tencent.github.io/omi/packages/omi/dist/omi.dev.js"></script>
  2. <script src="transfer-list/index.js"></script>
  3. <m-transfer-list
  4. id="myTransferList"
  5. onChange={this.onChange}
  6. left="[{
  7. text: 'Line item1'
  8. },
  9. {
  10. text: 'Line item2',
  11. checked: true
  12. },
  13. {
  14. text: 'Line item3'
  15. },
  16. {
  17. text: 'Line item4'
  18. }]"
  19. right="[{
  20. text: 'Line item5'
  21. },
  22. {
  23. text: 'Line item6'
  24. },
  25. {
  26. text: 'Line item7'
  27. }]">
  28. </m-transfer-list>
  29. <script>
  30. document.querySelector('#myTransferList').addEventListener('change', function (evt) {
  31. console.log(evt.detail.left)
  32. console.log(evt.detail.right)
  33. })
  34. </script>

API

Props

  1. {
  2. left: object[]
  3. right: object[]
  4. }

Event

  • change