index.js 303 B

123456789101112131415161718192021
  1. Component({
  2. options: {
  3. addGlobalClass: true,
  4. },
  5. properties: {
  6. list: {
  7. type: Array
  8. },
  9. onClick: {
  10. type: Function
  11. }
  12. },
  13. methods: {
  14. clickItem(e) {
  15. const {
  16. item
  17. } = e.currentTarget.dataset;
  18. this.triggerEvent("onClick", item)
  19. }
  20. }
  21. })